-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixes some player's origin displacements for fire events, impulses commands… #442
base: master
Are you sure you want to change the base?
Conversation
Here's a test I did: Seems to hold up. |
…sed before the player's thinkings, fixed it by moving the processed impacts before thinking functions.
Exactly there is no point running client side lag compensation, but prediction does. I didnt mean something else, sorry again if you understood something else. And yes I've read that. " You also have to remember that because the server beholds a random seed that’s purposely different to the clients to stop the client predicting the seed, the shot you fire doesn’t appear where you see it on your screen because the seeds are different and not given to the player to prevent calculation of the spread thus nospread "
I know. |
Are you sure this issue is not related to the slow motion you enable to test it? I mean, did anyone test it while not in slow motion? For example, recording a 300 fps video while the game is in real-time and then checking this video out. |
Though this pullrequest break with physics props (thanks gocnak) still, so I'm going probably to commit another fix for it. The simple solution would be to take the old origin of the player before calling the game movement and set this origin for shooting position , but it won't fix others things. |
2 years later.. I really need to re-work on it properly.. That'll come. |
We are eagerly awaiting |
This comment has been minimized.
This comment has been minimized.
Pls no hate, love. PS: |
We'll be here when you finish it king. |
I did this like a year ago, Valve doesn't care about it :( |
Hey it's been 2 years again, I said I should have worked on it, but guess what... Time passes, and now I realize it's been already 4 years I did that pullrequest and it has been 10 years since I've been starting to code on that engine. No really, I think this should be on top of my priorities so it can be even considered to be implemented in valve's code, like I said they probably waiting for me in secret to finish it... I must tell that they're not very communicative sometimes, probably busy I don't know. I saw that there was a CS:GO update about making custom client plugins that could be used to fix the game, I think I tried to email them about it so mine could get signed by them, but I don't even know if they saw it. |
sharklaser tried to fix desync/antiaim back in 2018 and even released source code to fix it and emailed them about it but they didn't even bother with fixing that so i doubt they'll implement any of this tbh, it sucks but theres only so much u can do... you can release it if u think it'll help modders using the sdk in the future or smth but ye :/ |
Well, if its purpose is to be used on CS:GO it is quite useless because matchmaking servers are hosted by Valve. So I doubt to see it any of it soon. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
More information on this fix can be found here: ValveSoftware/source-sdk-2013#442
ValveSoftware/source-sdk-2013#416 ValveSoftware/source-sdk-2013#532 ValveSoftware/source-sdk-2013#448 ValveSoftware/source-sdk-2013#515 ValveSoftware/source-sdk-2013#502 ValveSoftware/source-sdk-2013#486 ValveSoftware/source-sdk-2013#381 ValveSoftware/source-sdk-2013#442 ValveSoftware/source-sdk-2013#380 ValveSoftware/source-sdk-2013#362
I can not find that pr or src from github/google, can you share the link? |
How can I apply this fix to no more room in hell ? I tried here it doesn't work |
I just tried out a bit CS2 today, and my feelings seems to be what I thought it is. https://files.catbox.moe/qsmyr5.mp4 This is with noclip, and nospread. What we see is that it does indeed take the shot where I clicked, but I would expect it to wait for the firing animation (so the tick) for the blue bullet to appear right in front of me instead of being where I clicked. Sub-tick is breaking prediction and you can see that by the way I'm lagging after the next tick, and this must be normal since CS2 doesn't seem predict the sub-ticks at all. I'm also getting some acceleration I shouldn't have; and I don't think that is the right behavior here of course. To me the whole sub-tick system seems to be conceptually wrong, even if they fix prediction. Anyway what you see here is not CS anymore, it's another game based on frames. One way to conceptually fix it is to do like I said above, the whole logic for "events" like shooting needs to run on a entirely different logic than movement if you want to do it per frame basis. That way even during timescale being very low, it is still possible to shoot any time we'd want to and not waiting forcely for a tick to happen before seeing the fire animation and the bullet. We could also easily interpolate the position based on X "event" (reloading, shooting, openning a door, anything that interacts with something) which is sent with a fraction (could be interpolation_amount) to the player. But I'm not sure how well that will scale, especially for cheaters and performance:
By the way if prediction breaks, I wonder where they can take the interpolated shooting position, since position and networked variables (punchangles) are mostly (smoothing) uninterpolated during predictions errors, shouldn't be a problem though if they send directly angles and eye position. |
Fun fact; if you do cl_predict 0, it still demonstrates perfectly the problem described in the pull request. Like I said, this isn't a problem with interpolation much in the first place. (I haven't reverse engineered the game yet, I just know they take the eye position from here, that command prooves it, which is an issue) It also seems they fixed prediction for their sub-ticks too, which is a good thing, it was really an issue before. It's gonna take a while for them too to implement it properly by applying a fraction (gpGlobals->interpolation_amount or something else) everywhere in the game movement and physics, Think functions, etc. I won't bash at Valve I think they expected us to be happy with it but to be honest I would be happier with them removing it for now and thinking of another solution to fix interpolation problems that doesn't affect tickrate. |
I'm so glad Kamay showed up again and is back with great input. I honestly hope Valve does take a deeper look into what they have done (and in my opinion, broke) and fix the game. |
Found another way to "fix" it by looking into engine code a bit more. XutaxKamay/css_enhanced@fbc45f4 Right now like I said in the commit with high enough fps it is not noticeable and does not require any of the above solution(s) I mentioned, the downside is that it might be a bit jittering when you don't have enough fps, but otherwise it runs pretty smoothly and does not require any user commands modification and fixes some local player interpolation issues. (finally, the user commands matching the screen) That still requires though fixing the shooting position being 1 tick ahead. & For a bit of context this screenshot was taken when FireBullet is fired using noclip without timescale, notice the velocity and precision here. (ignore punchangles) What I can say now though, is that objectively sub-tick (frame based buttons) has still its uses for having inputs buttons less delayed and gain some advantage of not wanting a tick to happen, but I'll keep saying that it shouldn't be used for movements at all. |
Turns out it was very easy to smooth out aswell: Just substracting the old interpolation amount that wasn't taken into account will do the trick For reference, here is 1 frame, 1 tick, 9 frames, 1 tick sequence:
As you can see, 0.930525 is a lot better than 0.969672 on the last frame to go on a new tick with 0 interpolation amount again (so going the new position). 32 tickrate, 33 fps:
63 fps, 32 tickrate:
Seems like good enough to me on low fps aswell. Of course, there is still angles to be "tick based", but that is fixable aswell, momentum-mod & mev in the past has made such feature (m_rawinput 2) and since we have proper interpolation amount, we could even try to do some very smooth tick based mouse input. |
Tried to make it a bit smoother, https://github.com/XutaxKamay/css_enhanced_waf/blob/master/engine/host.cpp#L3194 |
…s, impulses commands etc... (ValveSoftware/source-sdk-2013#442)" This reverts commit 2e969d3.
Don't mind the code, it's not the cleanest. This is the method by using interpolation_amount, I finally took this method because it made the game a bit unsmooth previously even if it was very subtle, it also has been noticed by some others playtesters. By doing this, I have noticed a problem also with interpolation_amount, the fact that it gets calculated after CreateMove makes it late by one frame. I believe this problem is also on CS2. The variable needs to be recalculated before CL_Move is called and restore it to previous value to avoid any interpolation problems. Some people might prefer to take the shoot position the last frame before a new tick arrival though, but if you want to match the interpolated position on the same exact tick it fires, this is what you want. |
Idk when, soz.
... Previously some years ago ...
This fixes shooting problems and others things while pressing a button while moving etc.
https://www.youtube.com/watch?v=VPT0-CKODNc
Another example (the radar describes perfectly the problem):
https://www.youtube.com/watch?v=pr4EZ06mrpQ
Why is this happening?
Well, this is happening mainly because of interpolation, and how the function RunCommand works finally. Let me explain.
In fact, the taken shooting position is the new one computed from the game's movement, and not the current one.
You can see this happening by using timescale, and getting some speed.
The game is computing the new interpolated localplayer's data from the prediction data (BaseInterpolate1 from C_BaseEntity) by getting the final predicted time (so the final predicted command) and removes a tick interval to actually take the previous final predicted time , for having data to interpolate with! , and adds a tick interval where it's mulitplied by interpolation_amount (this is computed per frames, and it goes to 0.0 to 1.0) to go on the final predicted time, wich finally goes to what you should see.
If you try to interpolate directly from the final predicted time, there wouldn't be any data to interpolate with, so that's why Valve is removing a tick interval on the final predicted time to interpolate the localplayer.
But it makes issues on player's gameplay we must remember that since the commands are ran per ticks, the changes are instantaneous, so when you're actually firing, you're still on the previous predicted time, and not the final one.
You see the world and shoot as it was previously 1 tick before and not when it was when firing when you move.
The solution of what you would think of would be of course to disable interpolation on a player side,
but that would not make a smooth gameplay (so makes still a game unplayable) and the player wouldn't even predict his next position to actually shoot at the head of the player correctly anyway (or he must be a real machine to do that) ,
but why?
Since the game is running the commands per ticks (this is not really true on client-side prediction or even server-side due to dropping packets but to make it easier to explain) you'll suddently "teleport" to the other side and see your bullet at that position, instead of seeing your shot behind, as expected and predicted by the player.
So the solution is just to call PostThink (wich handles mainly fire events, impulse stuffs etc), before applying the final data to the player, so interpolation is not a problem anymore, the weapons take the right origin to shoot the bullet with, and much others stuffs! Like collision bounds, or when you're actually landing with high velocities, it stops the falling velocity at where it should and not 1 tick before. (bunny hopping purposes)
https://steamuserimages-a.akamaihd.net/ugc/909030263364841206/048560EB944800B68FF1F52920763D5B66231AE7/
Here is a view example of what is happening, blue = what the game actually see, red = what the player saw in the game.
The more lower the tickrate is, the more it is shifted and maybe unplayable.
Imagine servers with 33 ticks, the shift might be too much even for 100 velocity units, it's like 3 units of displacement or more
I hope valve and people will understand what I explained and hopefully this gets fixed on all valve games so we get a proper gameplay for everyone! (Yes since I guess valve is using this code for every games, it needs to be fixed on every games)
Also not to mention that every hacks will break since they're using the gamemovement's to predict their current commands since it's not truely a prediction problem anyway.
Good day and thanks for atleast reading!
PS: Sorry for my english if it's not correct, but if I get understood, it's the more important.