Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rhythm game: DSP Buffer File, Best latency or Best performance?

Discussion in 'Audio & Video' started by Itooh, Jan 7, 2017.

  1. Itooh

    Itooh

    Joined:
    Nov 11, 2016
    Posts:
    2
    Hello!
    I'm a beginner with Unity, and my first project is a minimalist rhythm game. I have been able to make it work fine in the editor on Linux, and have recently built it for a first beta.
    Unfortunately, while the game was running well on Linux, I discovered that on Windows, it was having a nasty stuttering in audio! For game relying on music, that's not really cool.

    So I switched to Windows to try to fix that, and discovered this:
    I had the audio settings "DSP Buffer File"set to Best Latency. Since I want it to be a quite precise game, it seemed logical at the time, and it actually made the game more reactive. But, on Windows, it was actually the cause of the audio stuttering! So I had to set it to "Good Latency" in order to have a pleasant sound.

    However, now, the game has latency (it makes sense alright)! It's a short latency, only a fraction of second between player's input and game's reaction. So it doesn't make the game unplayable, but… it's not great either. For someone like me used to Rhythm Heaven, it feels really weird to push the button "in advance" to be in rhythm.
    Ironically, I still don't have any latency on Linux. Well, I guess I can now tell Windows users "Your OS might have more games but they don't run well!". :p

    Anyway, that situation concerns me. It should be possible on Unity to have a game with very little (to none) latency, while still being able to play music. Right?
    I've tried several things. Like settings Load Type of audio assets to Streaming instead of Decompress on Load, but to no avail. I've also checked CPU usage, and it doesn't seem to be a problem at all.

    So, my first question is: if you have experience with rhythm games in Unity (or even fast paced games), would you suggest to set DSP Buffer File to Best Latency, Good Latency or Best Performance?
    And my second question: Um, well, any idea on one of the two issues mentioned above?

    Actually I could even go with a third question if you want to try out the game. Do you also perceive a latency? Yeah, there's the dumb possibility that it is caused by my machine, and I still haven't had many testers yet. So regardless of the game itself, I would like to know if you also can hear a delay between the moment you press a button, and the moment the game reacts.
    Edit: I've finally been able to test it on other machines, and the latency is there as well. So that's settled.

    I must confess, I initially feared, while working on Linux, that the game would just not compile on Windows. Well, it does, and it works. But badly… In some aspect, it might be worse, huhu!
     
    Last edited: Jan 24, 2017
  2. Thelo

    Thelo

    Joined:
    Sep 13, 2009
    Posts:
    98
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I work with latency a lot since I am also making a music game. "Best Latency" currently sounds ok on macOS, Android, iOS but not Windows. (It glitches and even slow down) I don't know why, but on Windows I am forced to use larger buffer size which means more latency. This is on the latest 2018.1b13

    I just made Native Audio plugin which skips to native level on iOS and Android. I might consider adding Windows support someday to see if it helps in getting both low latency and non glitched sound or not.
     
    msfredb7 likes this.