0
\$\begingroup\$

I'm trying to reproduce several sounds in a game I'm developing in AS3.

The game is like a TD game, and when I got 10+ of the same tower firing at the same time, I hear a horrible: "PRRRRRRRRRRRRRRRRRRRRRR"...

How should I manage this problem? How do PC games (specially RTS ones) manage this in order to hear something decent instead of an obvious and horrible loop?

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

I haven't had to run into this issue too many times, but what I've done is have a SoundManager class managing all my sounds - creating, calling, disposing.

If I'm finding overlapping sounds gets annoying (take a massive battle in SC2), I'll have the SoundManager keep track of "currently playing sounds" - increment this when a sound plays, decrement when it's complete, and not allow new sounds to play until AFTER that limit is back at a mangeable level.

Hey a bullet's a bullet. You don't need to hear 50+1 to get the idea of a ton of lasers firing and a battlecruiser.

HTH

\$\endgroup\$
1
  • \$\begingroup\$ +1 Battlefield Bad Company's audio followed the mantra of do more with less, and look how that turned out. \$\endgroup\$ Commented Apr 6, 2011 at 5:13
1
\$\begingroup\$

Typically what I do is I have the sound manager prevent the same sound from being played over top of each other within a small period of time.

So let's say you have 5 towers that all would start firing at the same time (for the sake of argument, let's say the same frame). They would all tell the sound manager to play a "tower type X fire" sound. The sound manager would see this, and only play a single instance of this sound. That sound type won't be allowed to play again until some short period of time later (a couple of frames at least, maybe close to something like a quarter of a second or so). That'll at least prevent the sound from being really loud.

There's some game/audio design that can go into that as well. Keep the pace of the game slow enough and your sounds short enough that you don't have so many bullets firing on screen at a given point in time.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, I think Ill do that, thx for your advice. However, what if when two or more sounds play at the ~same time, I play only one sound but at a higher volume?, would that look fine? \$\endgroup\$
    – Artemix
    Commented Apr 7, 2011 at 12:57
0
\$\begingroup\$

When you ask to play a sound, it helps to play a 'logical' sound rather than directly triggering a physical wave. Instead, leave the logical sound object to handle that part, and it can do something like playing 1 of several different versions of that sound in sequence (aka 'round-robin' samples), or picking one at random, or pitch-shifting and changing the volume on them slightly to give the impression of them sounding unique, etc.

Most AAA games have dedicated editors so that the audio guy can specify the different samples that go into each logical sound without needing to do any programming. The game then just loads in the sound bank that the tool generates.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .