Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411512 Posts in 69376 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 27, 2024, 06:45:41 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Using Unity3D for a Rhythm Game
Pages: [1]
Print
Author Topic: Using Unity3D for a Rhythm Game  (Read 18314 times)
PurpleCurse
Level 0
**


View Profile
« on: April 16, 2013, 02:44:07 PM »

Hey everyone,

I'm looking to create a traditional rhythm game (such as Dance Dance Revolution or Guitar Hero) for the PC. As of now, I hope to develop it with Unity3D (because that's the only engine I'm used to). Unfortunately, that might not be a possibility.

I've done some research on the internet, and some people are claiming that the Unity engine does not allow you to access what you need to be able to sync music to a "beat map". Others say that making a frame-independent game that required that much precision would be unplayable to users with lower-end computers.

I'm sorry if it doesn't sound like I know what I'm talking about (I probably don't), but does anyone know if making a rhythm game is possible? Anyone know of any rhythm games that were made with Unity?

Thanks in advance!
Logged
TomHunt
Level 3
***



View Profile WWW
« Reply #1 on: April 16, 2013, 02:54:35 PM »

If you're using the free version of Unity, then yeah I'd agree with the internets. You don't have any guarantee of synchronicity with an inherently asynchronous audio engine.

If you've got the pro version, then if you needed to, you could just roll your own audio playback if you needed to as a plug-in.

If you don't already have Unity Pro, you'd probably be better off looking into a cross platform C++ library like SFML.
Logged

~tom | □³ | kRYSTLR
Xienen
Level 3
***


Greater Good Games


View Profile WWW
« Reply #2 on: April 16, 2013, 04:39:54 PM »

If you're interested, I developed a PC/Mac/iOS beat based 2D game called Break Blocks that I've already handed out the source code for.  The game code isn't exactly clean, but the underlying engine code is pretty modular.  It uses OpenGL and OpenAL, using OGG and AAC music files, and WAV for sounds. It has synchronization techniques already employed to keep the Beat Marker(read from a beat file) in sync with the music, even on low end machines. The tools for the engine are also rough, but functional.  I can also supply the source code for the tools, if you're interested.

Source code links for Windows, Mac, and iOS.
Logged

TomHunt
Level 3
***



View Profile WWW
« Reply #3 on: April 17, 2013, 07:15:31 AM »

also, did you check out AudioSource.time? that might work for you, if you are able to use uncompressed audio (i.e. decompress at run-time using your own code/library - may want to use OGG to avoid license fees)
Logged

~tom | □³ | kRYSTLR
Richard Kain
Level 10
*****



View Profile WWW
« Reply #4 on: April 17, 2013, 06:06:36 PM »

I'm not quite certain how you would handle things like audio skipping. (which could conceivably mess up syncing to a beat track) But I do know that Unity's built-in animation system does allow for time-based frame-independent animations. I programmed a rudimentary lip-syncing system in Unity, and it works just fine for playing back lip-sync timings along with pre-recorded audio.

You would have to do some testing to see how well such a system performed. You would also want to do regular testing to see if the currently playing audio was relatively close to the beat-track animation. It should be possible to force the audio to skip to a particular location in case things have somehow gotten out of sync. The lip-syncing system I designed mainly deals with shorter audio clips, so I haven't had to deal with sync issues for extended audio playback.
Logged
jonbro
Level 3
***



View Profile
« Reply #5 on: April 18, 2013, 03:58:02 AM »

I am pretty sure that unity has added some stuff in the newest version to help deal with this... AudioSettings.dspTime, AudioSource.PlayScheduled, AudioSource.SetScheduledStartTime, AudioSource.SetScheduledEndTime

see here: http://docs.unity3d.com/Documentation/ScriptReference/AudioSettings-dspTime.html
Logged

PurpleCurse
Level 0
**


View Profile
« Reply #6 on: April 20, 2013, 08:48:00 PM »

Thanks for all the answers! Sorry I didn't reply sooner, haven't had access to a computer for the last couple days.

If you're interested, I developed a PC/Mac/iOS beat based 2D game called Break Blocks that I've already handed out the source code for.  The game code isn't exactly clean, but the underlying engine code is pretty modular.  It uses OpenGL and OpenAL, using OGG and AAC music files, and WAV for sounds. It has synchronization techniques already employed to keep the Beat Marker(read from a beat file) in sync with the music, even on low end machines. The tools for the engine are also rough, but functional.  I can also supply the source code for the tools, if you're interested.

Source code links for Windows, Mac, and iOS.

Wow, that's very generous of you, thanks. I've actually ran into your game before while browsing the greenlight projects, seems really fun! Grin

I am pretty sure that unity has added some stuff in the newest version to help deal with this... AudioSettings.dspTime, AudioSource.PlayScheduled, AudioSource.SetScheduledStartTime, AudioSource.SetScheduledEndTime

see here: http://docs.unity3d.com/Documentation/ScriptReference/AudioSettings-dspTime.html

I haven't heard of these before, they look very promising. I'm definitely gunna test those out soon, maybe Unity does has the power after all.
Logged
laggyluk
Level 0
**


View Profile WWW
« Reply #7 on: April 25, 2013, 12:21:30 PM »

I'm thinking about audio project too and done some research on various 'engines' to find something appropriate. From what I've read on Unity it doesn't give direct access to sound buffer so creating low latency music apps is not possible. Dunno how it looks with pro version, maybe .dll would do the job like TomHunt said.
Other thing I've found is that most android devices on the market today have significantly bigger audio lag then ios devices (big as hell actually, not suitable for live input processing)
Logged
bernardfrancois
Level 0
*


Prototyper


View Profile WWW
« Reply #8 on: May 06, 2014, 02:08:39 AM »

I know this is an old post, but since it came up when searching more about doing dynamic music in Unity3D, I decided to add my findings.

I basically wrote an article summarizing how we implemented a system with dynamic music, where 12 different loops are used to combine to 64 different tracks depending on how the player customizes their character.

http://www.previewlabs.com/dynamic-music-in-unity3d/

The post also contains a video where you can hear the music change as different buttons are pressed, so you can get an idea of precision.
I didn't notice any imprecision, but I do have to add that we used uncompressed music (which actually worked fine on an iPad 3 device).
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic