Page 1 of 1

Sound And Animation Challenge =^.^=

PostPosted: Thu Aug 04, 2005 4:59 pm
by NyahKitty
In the game I'm working on, Key Down 1, 2 and 3 will each fire their own laser cannon. Now I've tried two sound setups, one is where the laser sound is triggered when one of the keys is pressed. The other is when the laser beam actor is created. The Key Down is set to repeat while key is pressed.

Also, whenever a bad guy or falling energy pod is hit by a laser or generally when either of these actors collides with anything, the actor is destroyed and an actor with a fire ball animation is created in it's place and then that actor is destroyed when it reaches the end of it's animation.
Also, an explosion sound is played when the explosion actor is created. The alternative setup is the sound plays when either actor is destroyed.

The problem comes in that when I'm testing the game in Game Mode or running it as an executable, the actors are mostly visible as they ought to be, but the animations and sounds do not play at least 50% of the time they are called.

Is there a limitation as far as how many sounds and animations can play at once?

What can I do to fix this?

PostPosted: Thu Aug 04, 2005 6:16 pm
by BeyondtheTech
It's a likely possibility that since you have the "Key Down and repeat" feature, it's sending the same sound effect out many times over, flooding the available simultaneous audio channels you have Game Editor configured for. So, when it comes time for an explosion and there's no channels left to play, it won't play.

Under Config > Game Properties > Maximum number of simultaneous sounds...

You can set it to as much as 512, but I will assume it will severely hinder the performance of your game if you don't modify your code to NOT play a sound everytime a key is pressed.

Or, here's another option...

I'm an advocate for global variables and what I like is having a variable(s) for toggling things.

For instance, set up a variable called LaserSound and have it set to 1 when a KeyDown Event is made and set it to 0 when a KeyUp Event is made. Create a timer about the length of the laser sound file and upon its every Timer Event, have it play the sound of the laser IF the LaserSound value is set to 1. Otherwise, don't play anything.

See if that helps.

I'm just curious, is it just a single laser beam that shoots out, or beam "bullets" made up of multiple actors or clones? If its a single laser beam, you could play two sounds, one that initiates the sound, and another than loops a "beaming" sound. And, in the KeyUp Event, you can use the stopSound command to shut it off. It'll sound like it fired up the beam and is continuing the beam until you turn it off. That's just a little play on sound effects.

PostPosted: Thu Aug 04, 2005 7:01 pm
by NyahKitty
Turning off repeat on the key strokes and increasing simultanious sound channels is helping.

Thanks!


P.S. for future reference for beginners, you set # of sound channels in:

-Config
-Game

fun. fun.

PostPosted: Thu Aug 04, 2005 7:44 pm
by NyahKitty
Aiee!

I'm attempting to redirect the game from the WAV files to the .ogg versions of those files. The file browser does not seem to display the .ogg files in order to select them, is this normal?

What can I do to access file formats other than WAV's?

PostPosted: Thu Aug 04, 2005 9:55 pm
by brutalDeluxe

PostPosted: Fri Aug 05, 2005 1:40 am
by NyahKitty
Thank you.

I'm guessing that only one sound file at a time can play as music.

PostPosted: Fri Aug 05, 2005 8:42 pm
by makslane
NyahKitty wrote:I'm attempting to redirect the game from the WAV files to the .ogg versions of those files. The file browser does not seem to display the .ogg files in order to select them, is this normal?


Due performance issues, You play ogg files only in the Play Music action.