Search Unity

Level Designing A Rhythm Game

Discussion in 'Game Design' started by kendomaru, Jan 3, 2021.

  1. kendomaru

    kendomaru

    Joined:
    Mar 12, 2019
    Posts:
    41
    To anyone with Rhythm game experience,

    I'm in the process of designing a rhythm game and was wondering if there's a best method to arranging the obstacles. At the moment I've just been placing objects one by one, testing to see if the input matches the music, and repeat the process.

    The problem is that I now have what feels like miles of obstacles and I can't help but feel I'm not doing something right. I've checked out whatever tutorials I could (which are extremely few for the genre), and they all talk about doing what I'm already am. Is there a preferred method to best organize obstacle placement?

    Any and all advice and guidance is most appreciated.
     
  2. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    What do you feel like you're not doing right? Is something wrong with having "miles of obstacles"? I'm not really sure what you mean by "obstacles" (my limited experience with rhythm games is that the player's expected to press buttons when the symbols show up, which isn't what I'd call an "obstacle"), but do you want them to be in line with musical beats and instrument sounds?

    If I were doing that, I'd probably take the audio file and do some FFT and separate out various instruments and specific parts (like kick vs tom vs high hat). I'd probably reverse-engineer a QRS detection method to find appropriate onsets, and then use those for the "obstacles," again if I'm interpreting "obstacles" correctly.
     
  3. kendomaru

    kendomaru

    Joined:
    Mar 12, 2019
    Posts:
    41
    By obstacles I do mean the symbols you mentioned. If it helps in visualizing what I'm trying to do, the game Muse Dash is the best reference I can suggest.

    Two things I feel I'm doing wrong:
    1) the amount of objects I have causes the game to lag considerably. I'm not sure if I'm meant to create an object that generates the symbols off screen but at the moment they're just in a state of scrolling across the screen.

    2) I can't help but feel with all the rhythm games out there (with many levels of difficulty) there has to be a better placement method than just placing down a symbol, playing the game hoping it's in the right place, adjusting the placement if it feels off, and then retesting it again over and over.

    I'm not an audio engineer so I'm not at all familiar with the program you suggested. Would I be able to take any mp3 file and reverse-engineer it form there or would it need be recreated instrument by instrument in the audio program?
     
  4. kendomaru

    kendomaru

    Joined:
    Mar 12, 2019
    Posts:
    41
    To get a better sense of the situation, this is what my level layout currently looks like. Untitled.png
     
  5. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    It sounds like maybe you already have ideas in mind of what could be the answers and you're looking for comments upon those? Perhaps share if we're on the wrong path?

    I haven't designed these myself so caveat emptor. I'll break my answer into 3 parts: game engine, level design and user experience.

    1. Game engine
    It sounds like you might be talking about the lower level of how the objects get instantiated by the game engine?
    Rather than having objects in scene, I'd probably create a file that represented the obstacles, read that at runtime and instantiate and destroy (via a pool).

    2. Game Design
    Two broad camps would likely be automated and manual -- both for creation and testing.
    I.e. programmatically or manually deciding where/when to place 'actions' (obstacles) and programmatically or manually deciding whether the placement is 'good'.

    The FFT (Fast Fourier Transform) approach of automated creation is probably what all us techies would start with but I suspect it wouldn't give great results compared to manual Design.
    On testing I'd say some minimal automated 'viability test' would be handy to ensure there aren't bugs before human play through.
    Ofc you can take this all the way through to designing heuristics and doing classical AI based domain searching for a 'best fit' solution or.... fancy-pants machine learning approaches. What fun!

    3. User experience
    Personally I've only a limited experience -- too much Beat Saber. I'd say there are huge variations between good tracks and bad. Some can make you feel like a genius dance savant whereas others just feel like work. I wish I could help you there but I suspect only play testing can answer this!

    HTH & GL

    EDIT: fixed spellings, grammar etc from posting from my phone! :)
     
    Last edited: Jan 4, 2021
  6. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    I'm not an audio engineer either, just a goofball who likes biting off more than he can chew :p Anyway:

    1. This is definitely a problem. This shouldn't be happening unless you have like tens of thousands of objects. Can you click on one of your objects and show us what's in the inspector? And if you have any scripts on the objects, show us those as well. It's possible you're using the Update method or something, which would almost certainly be unnecessary.

    2. This is what I mentioned in my previous post, and while it would be way, way easier with access to whatever program was used to make the song (because the instruments and such would still be separated, and you could clearly see onset times), it could be done with a wav file. This might also be better handled manually, depending on how many songs you're planning, or at some level in-between.

    One way you could generate the obstacles is with a little program that allows you to play a song, then type on your keyboard, with output for the times when you press and release a key. You could designate different keys for different types of obstacles/instruments, and thereby generate all of the obstacles at once for a given song.

    If you're not sure how to do something like that and you think it would help, I'd be happy to work on it (in fact I might just start now).

    Edit: here it is. You can use this to get your desired onset and offset times for the beats of a given song. You can use that to determine where the obstacles should go. One thing to note: where your obstacles go in 3D space relative to their timing in the song is dependent upon how fast your character is moving. If they move 1 unit per second, you'd just do a 1-to-1 mapping. If your character moves at a different speed, you'd have to change that.
     
    Last edited: Jan 4, 2021
  7. kendomaru

    kendomaru

    Joined:
    Mar 12, 2019
    Posts:
    41
    Thanks so much for the programs! I definitely want to put it to use. Could you explain more in detail how I would implement the program? First time using something like this and I'm not very knowledgeable when it comes to coding.

    Also for clarification, the player remains in place while the obstacles come to them. Not sure if that changes anything.
     
  8. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    The idea of the program is just that if you type a key while the song is playing, it outputs the time that you pressed the key (and released it). You can use something like that to set the positions for your obstacles.

    Example: if you're pressing a key along with the song's beat and the times shown are 1.0, 2.0, 3.0, 4.0, 5.0, etcetera, you could position your obstacles at those same distances from the player - at 1.0, 2.0, 3.0, 4.0, and 5.0*.

    * - that's only if the speed of the player or the objects (doesn't matter which you're moving) is at the same rate. If you were moving the objects in their Update method with something like

    gameObject.transform.position -= new Vector3(-Time.deltaTime, 0, 0);

    ...what I've suggested would work. If you're using a different speed and you can't change it, you'd have to scale the values from the program.
     
  9. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I dont like to move the obstacles whatcha call it by Time.deltaTime. I like to call it a note or beat. Looks more smoother to move with the music by using audio time. I store all my beats in a Text file so the spawner can spawn it when it needs to. Call string reader to read text asset files. Better performance than laying out all of the obstacles in the scene.
    Code (CSharp):
    1. 120 365.7809
    2. 0 2
    3. 1 2.5
    4. 0 4.5
    First line is the beat per minute of the song, and the 2nd number is how many beats per loop. On the second line, 0 will spawn on the first track, and the 2nd number is the wait to spawn time. Mines is 0.5 seconds per beat so yeah. Another advantage of this is if you allow users to make their own rhythm game level, this will work.
     
    Last edited: Feb 1, 2022