[sound suggestion] Limit number of simultaneous sounds


#1

I’ve noticed that when you have 100 fighters firing and hitting things at the same time that the engine tries to render all 100 sounds at the same time (and you either hear an odd screech or no sound at all). I would like the game engine to have a limit on the number of simultaneous sounds playing at the same time. I notice this sometimes with a bunch of larger ships but by far the biggest offender is the fighter class.


#2

Yup this is an issue I intend to fix at some point. Weirdly, there is a cap, and the sound system never reaches it, so some piece of code deep down somewhere is switching enw sounds off without telling me, which is frankly not fair.
But I share the sentiment that this needs fixing for those close-in battles.


#3

Noticed this as well. I prefer the more dakka approach, because more dakka is always good. This means lots of lasers flying everywhere, and so there are a lot of sound effects going on at once. I easily reach the sound effects cap and it turns into this weird static, stuttering noise. Huge swarms of laser fighters cause it to happen almost without fail.


#4

Here’s a thought: could it just be isolated to the number of explosion sound effects? I noticed that when my fighter swarm went to attack, the problem didn’t start until my fighter’s shots removed the enemy ship’s armor and started exploding on the hull. I also noticed this in a massive cruiser battle.


#5

I did some work on this yesterday, and it’s better, not perfect but better. It’s actually quite a big problem in code terms. Sometimes, when zoomed out, there are actually more than 512 sounds being played that are visible on the screen. Mostly, this is individual laser blasts, and tiny impact explosions.
I tried various solutions, and went with one which only allows a maximum number of identical sounds per second. This isn’t perfect because really you need to ensure the ones you ‘let through’ are the loudest ones, and that means processing them all anyway.
I have the algorithm in my head to do this perfectly, which is basically to not play any sounds when they are played, but to build up a list of them every frame, then sort them by proximity to the screen center, and add them in prirotiy order until we run out of room.
I just need to find time to re-write it that way, which is non trivial. But even if I don’t find time for that, the newer system is aleready better with less drop-outs.


#6

Instead of going by screen-center, would you not rather go by size? If I’m zoomed out, I would prefer to hear the cruiser beam lasers and missiles, but not the lasers made by fighters. So you might want to order the list (priority heap*! ;)) by weapon size/weapon damage. That’s probably easier, since the guns will have easy access to their own damage stat in any design I would expect.

*Java has a decent implementation for reference purposes.


#7

thats a good idea
yeah i definitely dont want to hear the fighter ZipZipZipZipZipZipZipPoof when im looking at the cruisers duking it out… their guns have a lame caliber anyway,nowhere as crazily gratuitous as a proper cruiser laser cannon


#8

The thing is, the sound engine handles the volume calculations internally, and it only does that on the channels I pass to it. The problem is there are too many channels to send them all to the engine to do volume calcs on.
Imagine a laser beam sound 2 seconds long. 5 squads of 16 fighters attack 5 other squads. Thats 160 fighters shooting effectivly 320 sounds a second. If there are explosions on all of them thats 640 sounds a second. Only 60 of them are onscreen,but you need to check all 640.
This is worst case, but worst case does happen :smiley: