tbe icon indicating copy to clipboard operation
tbe copied to clipboard

Add sound effects

Open Wuzzy2 opened this issue 9 years ago • 7 comments

The game seems to be lacking any sound effects (for collisions, explosions, events, etc.), so I suggest to add sound effects to the game.

Wuzzy2 avatar Jan 05 '16 22:01 Wuzzy2

I remember that @kaa-ching mentioned that the game (currently) doesn't have sound effects deliberately. Personally I don't miss them, I prefer listening to podcasts/music/... while testing the game.

amarsman avatar Jan 05 '16 23:01 amarsman

I'm not one to like sound effects in games, mostly because they are repetitive and not my kind of taste. However, I know that it appeals to many people. And in a game like TBE they could be funny. If sounds gets in, it should be configurable though.

DjSlash avatar Jan 06 '16 09:01 DjSlash

Indeed, @amarsman correctly remembers (as I told him last night :stuck_out_tongue_winking_eye:) that I deliberately did not add sound effects and music infrastructure.

My vision is that TBE is a "casual game", people play that for a few minutes, win a level and move on with their life and play again in a few days. Sound is not part of casual gaming - you don't want sounds at work, for example :wink: .

I have never studied sound frameworks in games, so I'm not at all comfortable talking about them. For now, I'm going to put this in the backlog at "later than 1.0".

kaa-ching avatar Jan 06 '16 10:01 kaa-ching

Well, IMO this should be on high priority. Games consist of: graphics, physics (or gameplay logic) and sounds. And now, you're simply missing one part of it. How is it going to attract people to play (especially younger).

It's not difficult to implement (e.g. use OpenAL soft, or any other library, just needs 2D sounds). And likely an easy thing to find and add few sounds, e.g. by searching on https://www.freesound.org/.

Which games do not have sounds? I'd say most do and also have a simple menu for disabling sound and music, and setting their volume. I agree about no music though. Everybody has different taste, it gets too repetitve and makes the game bigger in size.

cryham avatar Jun 02 '16 12:06 cryham

When we first ratrted the game we intended it to be a bit of a timewaster game people would play while waiting for other stuff to get finished or something like that. (Think minesweeper, solitary etc) In such a game sound effects would be unnecessary if not downright annoying. On the other hand, some of the objects we have really cry out for a sound, either realistic or ludicrous. But if we ever decide to implement sound I strongly suggest a prominent silence button.

lspacenl avatar Jun 02 '16 18:06 lspacenl

I'm not going to bother with sound myself for the foreseeable future. I'm available to discuss implementation details and I'll happily take patches.

kaa-ching avatar Jun 02 '16 19:06 kaa-ching

Okay, I give some detailed thoughts about this:

Qt has a few sound-related classes: QSound, QSoundEffect and QAudioOutput. Which is great because this means playing a sound can be done with a simple connect. But that's for user interface interactions, which is the boring part. :D Also, looped sounds are supported, so Qt is again a lot of help here. :-)

If I understood correctly, Qt only supports WAV files which means TBE needs to include some extra library, we surely don't want to ship WAV files!

I would go either for Opus or Ogg Vorbis-based files. Opus has a better compression ratio but Ogg Vorbis has more sounds readily available. Technically, I think, Opus is superior to Ogg Vorbis. We can still transcode files if needed, of course, but we should be careful not to waste too much quality. If we find enough good lossless audio files, we have of course a free choice of format.

Then we should decide whether we want positional audio (making use of stereo) or just playing simple sound effects for any events. Of course the latter is simpler and may still be “good enough” for our purposes. Honestly, I would go for the latter first, in hope that extending the system later will not be too hard. Positional audio would just mean that the horizontal position of an object is used to pan the object to the left or right side of stereo speakers.

Then the major question remains what kind of events should cause sounds. I have two categories: First one is for everything happening in the simulation, second one for user interface interactions.

Simulation sounds just happen based on whatever happens in the simulation. TBE checks for a certain event to happen then starts to play the sound files:

  • Collisions
  • Rolling balls
  • Detonator box' handle pressed
  • Dynamite explodes
  • Mobile phone calls / receives call (for DetonatorBox, Dynamite)
  • Object with PivotPoint is rotating
  • Pingu dies
  • Pingu escapes
  • Balloon pops
  • Cola bottle is emitting cola
  • Spring is heavily pressed
  • Whatever else I have forgotten :P

Implementation details:

  • Collision sounds are probably the most important ones. These are single-shot sounds which are only for movable objects and each movable object has a single unique collision sound. A hammer could make a hammer hit sound, a bowling ball a bowling ball impact sound, etc. The sound becomes louder the harder the collision. There should also a minimum “impact speed”, below that no sound is played. Collisions between a movable object and a static object should cause sounds to be played. But it needs to be checked whether collisions between movable objects should also cause sounds or if it sounds too WTF, like a collision between bowling ball and volley ball. On the other hand, the bell from the Ring the Bell level immediately comes into mind
  • Rolling balls cause a looped sound effect which becomes louder the faster the movement. The tricky part is how to know when a ball “rolls”. Maybe this could be inserted into the part where friction is handled (I don't know)? If yes, that would be great, since this would also allow for, let's say, a sound for a sliding carboard box
  • PivotPoint: This can be used to add, let's say, a quiet wood squeaking sound for the rotating bar, and maybe other effects for other things. Also, volume increases with speed. Not really important but would be nice
  • Cola bottle: A simple looped sound should do, maybe decreasing in volume over time
  • Detonator box and dynamite: Ideally, sounds go like this: Detonator box handle pressed—“Beep beep” (first mobile phone)—“Beep beep” (second mobile phone)—“BOOM!” :D
  • Technically, the sound effect itself can be generalized by storing it in a property, i.e. CollisionSound for collisions, FrictionSound for rolling balls and such, RotationSound for objects with a PivotPoint, etc.
  • Not all objects should have collision/roll/rotation sounds. A collision sound for a ballon does not really make sense

Then, the user interface stuff is not as important and I am not sure if we need sounds for every button press. But a few sounds would clearly add to the flair, sorted by importance:

  • Victory
  • Failure
  • Simulation mode changed: Pause/Start/Stop/Fast-forward/etc.
  • Object placed
  • Object removed
  • Pie menu opened
  • Post-it opened (paper sound or something)

Wuzzy2 avatar Jun 02 '16 21:06 Wuzzy2