-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some strange weapon prediction behavior #2566
Comments
I think this also is a reason of bug, when on client side weapon shoots two times instead of one (manifested as double bullet hole decals and two pulled shells instead one). |
Potential duplicate of #1621 |
@SamVanheer do you know something about this problem? |
I looked into weapon prediction event dispatch problems before and i concluded that there were issues in the engine that could cause events to be skipped somehow. I never managed to figure out what it was exactly that caused it but i suspect the issue there lies with the limit of 64 frames that can be stored for rewinding and playback when resyncing to the server. As far as events and weapon actions playing multiple times goes this is to be expected. The client will run the same frame multiple times, but animations and sounds are only handled if the engine is telling the client to run functions: halflife/cl_dll/hl/hl_weapons.cpp Lines 1043 to 1081 in c7240b9
The Note that GoldSource's prediction code is very simple and was slapped on after release so it can't handle complex cases. You should always design your code to use server authorative decisions to avoid issues. If you need to synchronize state you should use Lines 1585 to 1649 in c7240b9
halflife/cl_dll/hl/hl_weapons.cpp Lines 660 to 1041 in c7240b9
This code is all very ugly since it has to operate within the engine's networking system which can't handle arbitrary data like Source or other modern engines can. I used virtual functions to allow for class-specific networking: Regardless you will find it difficult to handle stuff on the client side without glitches if it requires multiple sequential events. |
@SamVanheer do you have some new info about this event double playback issue, please? |
See #1621, that's probably what causes this as well. |
When I working on my mod, I found out some strange things.
I added this piece of code into PrimaryAttack() method:
When I tried to shoot once time on local listen server, it's ok
I see this in my console:
BUT, when I try it in multiplayer or using fakelag, I see this:
With ping 20:
With ping 80:
The problem is PrimaryAttack() called multiple times, and the more ping, the more method calls occur.
In my mod this breaks melee combos, when player should perform certain number of punches, but due to multiple calls, punch counter totally breaks.
I tested this on pure HLSDK code, and problem still occur in it.
Also, I tested it on 4554 engine build, and on last Steam engine build (8196), but problem also still occuring.
Why this can occuring? How to fix it?
The text was updated successfully, but these errors were encountered: