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
game: Changing fixed physics added velocity to emulate framerate-dependent behavior #1633
Conversation
@isRyven Could you do a quick review? You might be the most qualified here. |
From brief review: is it correct that it only should "adjust" the z axis velocity? For a proper emulation wouldn't you need to correct all 3 axis (after all vector snapping affects the whole vector - meaning that rounding will happen for all 3 axis)? |
I don't think it's the case. I based it on etpro forums where they always state they adjust jump velocity / jump height no mention of other velocities. For example http://bani.anime.net/banimod/forums/viewtopic.php?t=4113 Another thing is just rounding is not enough for velocity to be framerate-dependent. etlegacy/src/game/bg_slidemove.c Line 75 in 4cff173
Because of fixed gravity and frametime and the fact that the velocity is rounded so it's always integer here it makes it so that at certain frametimes it will always get rounded up, because there is no variability. This part of code is only for z axis. I haven't really checked out how other velocities work but the only place I can find without much checking is this Line 555 in 00b35a7
I might check it later today and if not tomorrow, but I don't think it's is needed based on reasoning above (but it's not like I know everything so yea :d) and the fact that from not only my own test jump speeds are pmove_fixed like or b_fixedphysics like. |
Ryven has a good point. Velocity snapping affects all vectors, but this patch only touches Z vector. Even though it felt as it should for me when I was testing, some additional testing with X/Y vector speed should be done too. |
Yeah, basically the question would be, shouldn't x and y velocity now be frame dependent, and for instance on 333fps you should get bigger speed boost? Obviously this wouldn't match the original 333fps behavior, but still. |
Quick test: this patch allows for 3ups faster wallstrafing than should be possible. You should be able to only achieve 442ups while wallrunning, but this patch allows for ~445ups Legacy with ETJump with Adding Edit: ETPro is consistent with ETJump here, also allows only 442ups. |
Yeah and i guess the effect is more visible with 333fps, i can get much more speed even by just strafing around on flat surface. |
I get your points, but at the same time I don't see any difference in actual gameplay even when the numbers are different at least as of now. The jump height looks fine with this and yet if you look at the z velocity it's different from pmove_fixed a bit anyway in simple jump up. If you compare the z velocity provided by Kimi from ETPro it's even worse. 1st frame on ETPro velocity is 271, when on pmove_fixed and this patch it's 264. Both solutions seem to work. https://docs.google.com/spreadsheets/d/1UTf9bSpHZpS17_A-Ubgq-n7Wx2ImniZp7-rHa_kmxTw/edit?usp=sharing There is no point adding that I could try to figure out other velocities and adjust them too, but when looking at numbers even this solution is not exact |
Yeah to be clear i have no issues with heights, it works quite good, i just had a concern about acceleration and friction which would remain without any special handling (unlike as it was before, and is in other mods). In essence even if there are differences with pmove they indeed are in some sort of tolerable range (especially taking into account the default 333fps range lock), actually perhaps we don't see big xy velocity boost because patch don't snap vectors anymore, and more accurate data is sent, also while jumping gammas i noticed it's actually much harded to jump with patch than with pmove, but difference ain't that big, not sure what to make out of it. I don't know if @Aciz performed any more extensive tests already, i'd leave the last word to him. |
I did some additional testing mainly some longer jumps and I agree it is not perfect (when you look at the other velocities), but I believe it's good enough. I'm not the best strafejumper so it might not be the greatest comparison. I tried simple jumps on adlernest from axis spawn and according to my tests this solution is closer to https://streamable.com/e52g1j etpro b_fixedphysics 1 b_fixedphysicsfps 125 So the question is I think how close you want to get to I don't think it's something that would replace |
More comparisons to etpro, there is almost no difference between https://streamable.com/1v890q etjump pmove_fixed 1 pmove_msec 8 |
The idea behind it:
Framerate-dependent physics come from rounding velocity because of
pm->ps->gravity * pml.frametime
.Gravity is 800 so at certain frametimes if the decimal places will be less than 0.5 the rounding will always be up.
For example at 125fps frametime = 0.008, 0.008 * 800 = 6.4
1st frame: 270 - 6.4 = 263.6 = 264 (rounding)
2nd frame: 264 - 6.4 = 257,6 = 258 (rounding)
3rd frame: 258 - 6.4 = 251,6 = 252 (rounding)
...
Some explanations of physics here too: https://www.youtube.com/watch?v=P13KmJBNn1c
The solution:
Check when the rounding up would happen and add the rounded up value, but scaled so clients various FPS is taken into account since it will be done on every frame.
I tested it against ETPro
b_fixedPhysics
,pmove_fixed
and Legacypmove_fixed
and everything behaves the same as here(jump height, min height of box is 64u):Map used for testing, big thanks to Aciz for making it!
pmove_debug.zip
refs #1379