TeamPorcupine / ProjectPorcupine

Project Porcupine: A Base-Building Game...in Space!
GNU General Public License v3.0
483 stars 280 forks source link

Sounds don't play when game is build #1533

Closed Ohda closed 7 years ago

Ohda commented 7 years ago

I build a standard PC game and i can't here no sounds when running the game.

koosemose commented 7 years ago

Well, to make this issue well and truly strange, while trying to see if I could figure out how to debug this, I went looking for a way to get logging from a build and changed Logging to Full for everything in Player Settings - Logging... still didn't get any logs.. but doing that also causes the sounds to work... o.O

koosemose commented 7 years ago

And making it a development build causes them to play too.

So far the most I've been able to figure out is that the audiofiles are sort of loaded, clips respond as though they're loaded, but have a length of 0.

I'm pretty much at the end of what I can figure out, and still can't figure out how to really fix this.

If it can't be fixed we may have to start looking into other options (either non-moddable sounds or an external sound library that is capable of handling streaming assets)

Jaytheway commented 7 years ago

There is a powerful external solution that's easy to use, and makes it easy to handle audio assets. I need to consult with some people on that matter.

koosemose commented 7 years ago

Any potential replacement has to be compatible with our license.

Jaytheway commented 7 years ago

Already handled the license. I contacted sales department of Firlight Technologies, told them about our project and GPL license. Brett Paterson, CEO himself, replied: "If you don’t sell your game you can use FMOD with non commercial license as specified in our EULA (available on sales page)."

FMOD is a sound engine. For implementers it is just a plugin inside of a Unity project. Couple of folders and scripts. Sound Designers can download Free FMOD Studio software to work on sound behavior, realtime mixing, sound profiling and assets handling. Most of sound designers are already using it, we (SDs) have to know how to use FMOD and Wwise (alternative) to be able to work in the industry. To be honest, it's very easy since it looks like any Digital Audio Workstation.

With FMOD we won't need to manually code essential features like the ones I listed in #1535, and many other. We won't need to think about voice handling (0.1f delay in SoundController).

It reduces sound implementation to just hooking up a Sound Event in a right place and sometimes passing some parameters to it. There are also an options of more complex sound implementation, if for whatever reason you need to do it so custom.

Here is the video of how FMOD Unity integration installs: https://youtu.be/KkQ89ZXv5sQ?t=6m6s There is also a short series of how to work with FMOD Studio in Unity, but it's mostly for sound designers.

Jaytheway commented 7 years ago

Just tested Builds with FMOD and our sound system:

bjubes commented 7 years ago

The only problem I see from the video is that using FMOD requires that the FMOD project exist alongside of the unity project (from what the video shows). That means that all the FMOD stuff will have to exist in the repo as opposed to how visuals works where there is just an exported .png and the repo doesn't need to know about the piskel or photoshop files that made it.

Will FMOD also allow for mods to change the audio files in streaming assets?

koosemose commented 7 years ago

Everything I can see from that it is not well suited to what we want, I can't see any way to load arbitrary sounds, I'm not even sure if it allows multiple banks of sounds which would be needed if sounds are to be moddable, and even if it can it seems to now require someone to use FMod to make any sounds for a mod, extremely obtuse code to trigger a sound from code, that I can't be absolutely sure will work from Lua.

If it can't be used for modding or limits modding to only use a certain special tool, it's not suitable for us.

dusho commented 7 years ago

I haven't check the sound code or how audio is loaded, but google gave this: https://docs.unity3d.com/ScriptReference/WWW.GetAudioClip.html doesn't that allow to load audio dynamically and play it?

Geoffrotism commented 7 years ago

I haven't check the sound code or how audio is loaded, but google gave this: https://docs.unity3d.com/ScriptReference/WWW.GetAudioClip.html doesn't that allow to load audio dynamically and play it?

That's what we have in place already.

Geoffrotism commented 7 years ago

Changing the build to have "Full Logging" for Log enables sounds to be played (see picture to replicate). I added one second of empty space to the front of the song i created and it plays perfectly. It's a really stupid solution but it does fix all the problems we have. We would just want to add a ReadMe to the top sound folder explaining this to any potential modders. Although we could try adding a second of space problematically during load time but i don't know if that would really solve the problem either.

image

Jaytheway commented 7 years ago

@bjubes Using FMOD does not require that the FMOD project exist alongside of the unity project. You need project only if you're working on sounds too. If your're not working on sounds, there are only 2 files it requires to work: (Sound Bank Name).bank and (Sound Bank Name).strings.bank - in the Build folder, which FMOD produces when Sound Designer build a sound bank from the FMOD Studio. untitled

It would be moddable, even when the game is Built. For replacing old sounds, if there is going to be a file with instructions for the event naming (or look up in the code). Basically everyone could then create their own FMOD project and name their Sound Events correspondingly and replace Sound Banks in the game folder. And because all events are already hooked up, it's one step less: untitled

For adding new sounds – just build a new sound bank that is not conflicting with the old one (there should be only new sound events) and hook it up.

Even including a FMOD Studio project itself does not take much space, it's 25 MB for now. It could be done by creating a separate branch for cooperative work on FMOD project, and merge only code hookups and SoundBank.bank file.

@koosemose Yes, you're right, any person who is not used to work on sound, and not willing to try FMOD Studio, won't be able to add arbitrary sounds by himself. Right now we have maybe 2-3 people working on sounds, and we somewhat coordinate using google spreadsheet. The question is, how much of arbitrariness could there be, so the project still could grow and become better.

"If it can't be used for modding or limits modding to only use a certain special tool, it's not suitable for us." – "If it can't be fixed we may have to start looking into other options (either non-moddable sounds or an external sound library that is capable of handling streaming assets)"

@koosemose I'm not trying to impose anything or to fight with anyone. We have problems with our audio, and I'm suggesting a solution. If no one likes it, well, we have good programmers here, I'm sure we can figure out something else:)

p.s. For the curiosity sake: games using FMOD