Raptor007 / aq2-tng

Action Quake 2: The Next Generation. Raptor007's sandbox for testing changes. When verified stable, this code is pushed to the official aq2-tng repo:
https://github.com/aq2-tng/aq2-tng/tree/bots
4 stars 2 forks source link

Weapon sound ugly when using sv_fps 20 with machine guns #56

Closed stan0x closed 7 years ago

stan0x commented 7 years ago

When playing on server with sv_fps enable sometimes weapon sounds weird. i do not know if its q2pro related or aq2_tng. It sounds like a double weapon sound with a sort of echo. i also heard the sniper rifle with a double shot.

Raptor007 commented 7 years ago

This is because enhancement #47 allows shots to begin on any frame. A single player's shooting will still sound normal because the delay between their shots is still the same. But multiple players shooting full-auto at the same time may or may not be synchronized. If they are out of sync, you will hear distinct shots more often than you're used to at 10fps.

The thing is, this isn't really a bug. Things can happen more quickly with sv_fps, and you're hearing the events when they happen.

To fix this server-side in the mod without adding shot lag would require a way to queue up a player sound and muzzle flash (they need to be linked) for the next FRAMESYNC update (10fps). This means everyone would see shots hit before you see or hear the player fire them... even when you are shooting and nobody else is! This would feel like a very strange lag, and it would require some ugly messy code to do it.

I think we'll just need to get used to the fact that shot sounds can happen more often with sv_fps. Clients can avoid this if they force sounds and other packets to synchronize to 10fps using cl_updaterate 10. They still get some benefit from sv_fps because the server will still handle input more quickly, but they wouldn't receive entity updates as quickly as they could be.

Raptor007 commented 7 years ago

No promises, but I thought of a better way this might be possible. It could sync sounds only if someone is currently firing a machine gun, which means most of the time there wouldn't be sound lag.

Raptor007 commented 7 years ago

First version of a fix for this: https://github.com/Raptor007/aq2-tng/commit/91a3a36244ab28f2d6a1c1590ca0883b6107890c

Raptor007 commented 7 years ago

Added sync_guns cvar and fixed FRAMESYNC sound lag: https://github.com/Raptor007/aq2-tng/commit/4b96f4be0ad249522e32640fb0439056c8b05aea

Raptor007 commented 7 years ago

Default sync_guns 1 should prevent strange sound overlaps, but in case it doesn't sync_guns 2 will force the old laggy FRAMESYNC sound behavior: https://github.com/Raptor007/aq2-tng/commit/74f4794289b70e81f76313cc258ac8fbc3d3f11e