


You’d write, in the Spotlight class script:įloat crotchet //the duration of a crotchet Say for example you had four lights that you wanted to flash on the first four beats of the song. In the most basic case, all you would check it with would be ground zero: the start of the song. You see, even when using the song position variable for all things that sync, there still needs to be a reference point that you want to check the song position with. (Game design tip: have as many things respond to the beat as possible! Preferably everything!)īut even then, there is something more subtle that you need to pay attention to – and this is what I struggled with at first. If you use some sort of elapsed-time function, it’s still not going to be accurate enough, and if the song skips for whatever reason everything will get thrown off.
#RHYTHM DOCTOR GAME UPDATE#
in the Update function), an inconsistent FPS is gonna throw the whole thing off. If you use a timer that increments every frame (e.g. Every object that needs to be in sync should do so using only the song position, and NOT anything else. This was used in my game to slow all the songs down 20% because I only realised after composing the music that it was too difficult.Īnyway, now that we have set up our Conductor, time to take care of the objects that need to sync to it!Ģ. By incorporating it into my song position variable, I can change the playback speed and still keep everything in sync. Songposition = (float)(AudioSettings.dspTime – dsptimesong) * song.pitch – offset Īside: the song.pitch is an inbuilt variable in Unity that gives the speed the song is playing at. What I do is, in the same frame that I play the song, I record the dspTime at that moment, so then my song position variable is set on every frame as follows: This varies from engine to engine, but in Unity for example, the variable to use is AudioSettings.dspTime. Songposition, a variable that should be set directly from the corresponding variable on the Audio object.
#RHYTHM DOCTOR GAME ARCHIVE#
Here's the post! (with diagrams and videos)Ģ022: Ludum Dare website has since been taken down, but an archive is here. For the latest Ludum Dare I made a rhythm game, and seeing how little documentation I managed to find out there about making one, I decided to do write a fairly long post on the 'rules' that I have become accustomed to using when making a rhythm game, after working on one for a few years now and doing another one for this jam.
