Friday, December 2, 2016

Rhythm Quest Update 4 - Notes!

We have notes!


We're actually starting to implement core functionality now, which is good!  I have a NoteManager which is keeping track of notes across my three different tracks.  The notes are loaded in via Levels which are now being loaded via text strings like ".... A... A.A." for easy editing.  The level loading could maybe use some additional work eventually, like loading from json/text files or something...ideally I'd be able to change the levels on the fly and reload without restarting playback -- that'd be the ultimate iteration tool!  Should be doable, but I have other things to focus on for now.

I can now detect whether notes are within the "hit" window, as well as when they're too far past and become a "miss" -- although for the latter case I don't have them actually doing anything yet.  I also need to handle "inactive" notes that are not on your current track correctly...

But importantly, you can now press the red "attack" button and you'll hit a note if it's there!  Note is an extendable abstract class (currently I'm just using "BasicNote"), which is good because I'm later going to have 2-note combos as well as held notes.

The blue button will eventually be "jump", but right now I have it triggering a track change to the bottom track to test that.  In the real game you won't be able to trigger track switches at any time -- you can only do so at certain junction points / transition downbeats that are marked in the song with some sort of fancy flashing thingy.

I also added a debug display to the upper-right which I can use to display whatever I need to.  Hooray!

Another very important improvement I did has to deal with the scrolling/timing calculations.  I wish I could say that getting the scrolling to work correctly is as simple as just setting the character's X position to the current time of the audio track.  You CAN do that, and I was doing that before, but the audio sample position isn't updated at the same cadence as Unity's regular frame update loop, so you get stuttering if you do that.

So I want to "sync up" the timing to the beginning of the song using audio sample timing information, but then for actually updating the timing per-frame I need to use the regular Time frame timer, not the audio sample information (with some sort of sanity checking to make sure that it doesn't drift too far).  I hacked together something quick to "sort of" make it do that, but it's not robust by any means and will probably have to be revisited.

The white line in front of the character represents the point at which you actually want to hit the notes (i.e. line up the "diamond" shape of each note to the line).  I'll have to experiment with different ways to visually show this -- for example, bars may make more sense than diamonds.

It's starting to actually look like something now, which is good!  I didn't have as much time today as I did yesterday to work on things, but we still made OK progress.  Gotta keep this up...

No comments :

Post a Comment