ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.67k stars 619 forks source link

[TFC] Grenade timer lag #2493

Open pizzahut2 opened 5 years ago

pizzahut2 commented 5 years ago

I guess this issue exists since the very first version of TFC. With the remaining player base concentrating on American servers, it is nowadays harder to avoid if you're located elsewhere.

The farther away a server is, the later the grenade timer sound ("tfc\sound\weapons\timer.wav") starts. If this was the only effect, players could adjust to it. However, with distance, there's an increasing amount of randomness as well. Thus on the same server (if it's far away), each grenade can go off a bit sooner or later than the previous one.

Scripted timers are relatively lagless. However scripts don't have a way to check whether a grenade has successfully been primed or not, and thus will always play, even when they shouldn't. Such a lagfree timer is for example available here:

https://web.archive.org/web/20180722233125/http://myweb.tiscali.co.uk/millard1/files/Client_sided_timer_2013_edit.rar

For this to work, the original grenade timer sound is replaced with a mute one. 0s length, but not 0 Byte since there's header information.

(I originally assumed the priming sound "ax1" is lagless, but this isn't the case so it doesn't help.)

Grenade timing for TFC is crucial because of hand-held grenade jumping, i.e. if the grenade (any type) isn't thrown when jumping.

Also on a side note, Fortress Forever (Source mod) has lagless nade jumping built-in.

pizzahut2 commented 5 years ago

Content of the "client sided timer 2013" readme:

=== QUOTE START ===


About:


OK, for those that don't know, in TFC all grenades have a audio beep timer.wav, but the timing you hear varies from server to server, most noticeably when playing overseas. There is an age old "fix" by making it client sided, by remaining the default timer to mytimer.wav and putting it in:/tfc/sound/vox, then putting a blank timer.wav in /tfc/sound/weapons/, and using a script.


Install:


-Choose a script and put it in 'userconfig.cfg' (if it does not exist make it or put in 'autoexexc.cfg'). -Put the 'tfc' folder in: C:\Program Files (x86)\Steam\SteamApps\ACCOUNTNAME\team fortress classic

// Lag Free - Hold (Default Style) alias +kgren1 "+gren1; spk mytimer" alias -kgren1 "throwgren" alias +kgren2 "+gren2; spk mytimer" alias -kgren2 "throwgren" bind "f" "+gren1" bind "g" "+gren2"

// Lag Free - Hold - Alternative (Exactly The Same Just Wrote Different) alias +grenade1 "+gren1; speak vox/mytimer.wav" alias -grenade1 "throwgren" alias +grenade2 "+gren2; speak vox/mytimer.wav" alias -grenade2 "throwgren" bind "f" "+grenade1" bind "g" "+grenade2"

//BUGGY. NOT FIT FOR USE // Lag Free - Primer (Press To Prime, Press Again To Throw) alias kgren1_throw "+gren1;spk mytimer;alias kgren1 kgren1_drop" alias kgren1_drop "throwgren;alias kgren1 kgren1_throw" alias kgren2_throw "+gren2;spk mytimer;alias kgren2 kgren2_drop" alias kgren2_drop "throwgren;alias kgren2 kgren2_throw" alias kgren1 kgren1_throw alias kgren2 kgren2_throw bind "f" "kgren1" bind "g" "kgren2"


NOTE:


"Default Style" works fine but "Primer" doesn't always respond well, not for me anyway. Don't know why. I made do with doing this instead:

bind "f" "primeone;spk mytimer" //Prime Primary Grenades bind "MOUSE4" "primetwo;spk mytimer" //Prime Secondary Grenades bind "MOUSE5" "throwgren" //Release Grenades

-Paft === QUOTE END ===

ChaosSpoofer commented 5 years ago

This would be a tremendously great fix for TFC.

As pizza said, precision grenade timing is absolutely essential for advanced movement techniques in TFC. Being off by a few milliseconds makes all the difference in terms of whether you can successfully execute specific grenade jumps or not. As this is the case, it's essential that the grenade timer be accurate.

The problem is (via experience, rather than parsing through code) that the client seems to wait for server-side confirmation that a grenade is being primed before starting to play the timer. But whether or not you succeed at a grenade jump is based on client-side movement and timing. So the timer is out of sync with the necessary timing. The current user-side solution is, as pizza mentioned, muting the default timer.wav file, and instead playing the file via the "spk" command, as that's completely client-side. But again as pizza mentioned, this then causes problems where pressing the key without a grenade will still play the wav regardless, as well as messing up popular two-touch grenade scripts.

So, it seems as if the solution is simply to make timer.wav play entirely client-side as soon as the grenade key is pressed, without having to wait for the server-side confirmation first.

Please please please fix this, and TFC players worldwide shall rejoice!