OpenRA / OpenRA

Open Source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C# using SDL and OpenGL. Runs on Windows, Linux, *BSD and Mac OS X.
https://www.openra.net
GNU General Public License v3.0
14.74k stars 2.69k forks source link

Mute units under fog #9487

Open clemty opened 9 years ago

clemty commented 9 years ago

Units not visible to the player should not emit sound.

Currently in TD, newly built stealth tanks make the cloaking sound, giving away the fact that the enemy built them. Also, stealth tanks already existing in a map audibly cloak at mission start.

Muting units would have the side effect that artillery fire may come out of nowhere though.

penev92 commented 9 years ago

This would also apply to firing and explosion sounds, I guess. Or maybe we want to keep those, as they don't reveal as much information?

HenrytheSlav commented 9 years ago

I would go for decreasing the "range" of hearing the sounds. I mean, you can hear gunfire from the other side of the map. Maybe limit it to 50-100 cells? Or make shroud muting too to some degree (for example only half of the range) or something like this.

clemty commented 9 years ago

@HenrytheSlav I was thinking about that, but wouldn't that be CPU-intensive?

You'd need to calculate the distance every time a unit makes a sound. Also, where is the person listening located? If you take the center of the camera you might not hear your units getting attacked on the other side of the map (would be an interesting gameplay mechanic though). If every actor is listening, you have to calculate a lot more distances.

Or maybe have a second, smaller, invisible ("sound-")shroud where units don't make the sound?

pchote commented 9 years ago

@clemty, @HenrytheSlav: The game already tries to do that, but it has never worked properly.

LavenderMoon commented 9 years ago

I think Tiberian Sun handled this by having certain weapons that would reveal shroud for enemies when they fired. I never fully understood how the enemy audio worked in any of the games, though. I want to say C&C64 used the sound-emitter's distance from the player's view in order to determine sound.