Wargame Making Off "Sound Channels and DirectShow Objects"
Author: | Mxthe
|
Submitted: | 4th July, 2009
|
Views: | 4726
| Rated: |
|
|
Hey, so for this first Making Off Wargame, I'm going to talk about how I splitted the sound channels, and the Direct Show sounds, so that I could play as many sounds as possible, without saturating the audio, or having sounds interrupting each other.
Basically, what you need to understand, is that MultiMedia Fusion 2 and Developer version, or even TGF2...
HELL ! Every clickteam applications have only 32 audio channels ! Now this is great for 2d games, really...Do you know any game that plays 32 sounds simultaneously ? I don't...It depends about how you optimize your sounds... If your game is going to be messy, have a lot of musics or sound, be a battlefield or going to get a lot of sounds, you might as well read this, if not, well read it anyways, it might help you !
So the point is, selecting which sound will be played as a sample, and which sound will be played by Direct Show...
FIRST OFF, EVERY sample you get in your game, you really should convert it to OGG Vorbis format ! You're gonna find that OGG Vorbis is really more flexible than the .Wav format, and it's MUCH smaller, its actually smaller than mp3 ! And MMF2 understands it, so I strongly suggest you convert all your samples to .ogg ! You can do that with audacity (link below)
Now the problem about Direct Show, is that the sound does not include itself inside the application, unless you include it by setting the "Include Internal Files" on, in the application proprieties.
The other way to include them, is adding them as files in the installer, and setting them in the right folder.
So now, to the sound themselves, the thing is, that every sound that lasts more than 5 seconds, like musics, jingles or long samples should be play by a Direct Show object...Why ? Because while the sound is played, it keeps one channel busy, which won't leave many space of other samples, or get interrupted if too many samples play, now you can set the important ones as uninterruptable, but you can't set every sounds like that, it won't work...
So the option is to use direct show...Now there is another problem with direct show, is that every sound requires ONE direct show object...So you quickly get flooded with Direct Show objects, but don't panic, if you organize yourself, you can find the right solution...
You can actually use some smart techniques, such as loading sounds that play in a specific situation, and have it load and play in that situation...I'll give you an example :
In wargame, when the player is about to win a round, a victory jingle plays, and if the player is about to loose a round, a defeat jingle plays, which is a really spooky music.
The thing is that, the victory/defeat sound are played by the same object ! How ?
The victory in Wargame is determined by the two areas, which team capture which area, so I simply set that if the areas are captured by the player, the Direct Show loads the victory sound, if they are captured by the ennemy, the Direct Show loads the defeat sound...So when the timer reaches 30 secs, the direct show plays the sound that has been loaded, either it is victory sound, or defeat sound, it will play...
That is a smart solution for this problem, it is just an example, but you can use this idea and turn it in your own idea...
I would suggest setting EVERY music in your games as Direct Show objects, if they are not MIDI, to free up some channels.
Now something else, I think some people will wonder how I made the grenade beeping and deaf feeling ? Well I won't say its "simple", but it's not complicated either !
This is how I did it :
When explosion touches player, set player flag 1 on; set player alterable value A to 25
When player flag one on, set Main Sample Volume to player alterablue value A
When player flag one on, and every 1/2 sec, add one to player's alterable value A
When player alterable value A is greater or equal to 100, set player flag one off, and set player alterable value A to 0
Basically when a explosion hits the player, the sound volume will set to 25, and increase every half a second until it reaches maximum (100) then the flag and value resets to 0 to be able to repeat the operation.
But what about the beeeeeep sound ? Well I created that sound with audacity :
http://download.cnet.com/Audacity/3000-2170_4-10058117.html?tag=mncol
It's a great free audio software I use for a lot of audio stuff !
I created that sound with by setting a very high pitch and aplifing static noise, until I reached a frequency I liked, and exported it as OGG Vorbis format.
Then the thing is, using a Direct Show object to play that beep sound, because if you play it by the application's sound, the beep sound will be low volume as well !
And that's the great thing about setting your musics as direct show, because if you get blowed off, the music's volume will not be low ! So that's all good !
Now, to optimize all your sounds, I strongly suggest you to find a system so sounds don't play away from the frame ! The solution I found is really lame...
What I did? I created an Active Object the size of the frame that follows the frame, and each time a sample is to play, I simply added a condition to make it play only if it occurs while touching this active object.
That's the solution I found, it's pretty lame and stupid but it works fine and it's flexible ! So what the hell! Duck tape is great to build planes ! Isn't it ?
And then you can push the idea further like I did, lets say for example you have 2 different sounds for a gun shot, one that sounds close range, and one that sounds distant, you set that if the guy that fires touches this "Frame" Object, it plays the close range one, and if it doesn't (Negate condition) it plays the distant one!
Simple right? You can do the same for explosions, and every sound if you want, but in that case it won't optimize ! On the contrary, you need to select which sound is important, and which is not !
So, I think that covers it for the sound, If I forgot anything, or if you have question, just ask, I'll answer
|
|
Mxthe
Registered 02/06/2009
Points 532
|