-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
improve: refactor walking for better responsivenes #1028
base: main
Are you sure you want to change the base?
Conversation
afacc0c
to
b47ed98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b47ed98
to
aa7f8dc
Compare
me test : pressing both keys (not holding down one key permanently) 2025-01-09.12-57-04_1.mp4 |
@nekiro because that was what reset the step when you didn't walk for 150ms. |
I have reworked the whole walking, it seems better to me. I also deleted some useless options. |
I've added a cout at Game::playerMove in the server code to test this change 2025-01-12.06-49-44.mp4 |
I'm testing on tfs master and no such problems were spotted |
I gave this a try, but unfortunately, as is, at least for me, it does not yet solve the issues with walking. I've tried playing around with the delay settings in Options, but I am still having the same issues as before. Here is a comparison between OTCv8 and this OTC of walking in a straight line and then suddenly stopping. I was pressing the W key to walk north and stopped pressing it as the char arrives at the gold coin. In OTC v8, the char stops exactly on the tile and immediately when I stopped pressing the W key, as it should. In this OTC, the char stops for a second on the correct tile, but then takes an extra step forward after I'm no longer pressing any key. lv_0_20250109184103.mp4Here is a comparison between OTCv8 and this OTC of walking back and forth between two specific tiles with gold coins to show how the clients handle sudden direction changes. In OTC v8, the character stops and turns around on the correct tile with the gold coin when I stop pressing one key and start pressing the other, as it should. In this OTC, the character seems to "stutter" during this direction change as if the client is predicting that I'm going to keep going instead of turning around. lv_0_20250109184720.mp4Here is a comparison between OTCv8 and this OTC of walking over a path, marked by gold coins on the ground, and making two turns in different directions. In OTC v8, the character follows my exact key presses with no delay, no extra steps, no attempt to correct itself, and perfectly follows my intended path over the gold coins. In this OTC, the character "stutters" during the direction change and walks on the wrong tiles. lv_0_20250109185348.mp4Only difference in these videos is the client. I'm using the same character walking with the same speed, playing on the same server (protocol 10.41) with the same average ping (around 150 ms) and average fps (around 120) playing on the same PC. I'm hoping this can eventually be sorted out and the walking system in this OTC made to behave and feel as fluid and responsive as OTCv8. |
After further investigation and testing, I was able to almost completely "fix" the walking issues I described in my previous comment with the following two changes: Following @kokekanon's suggestion, changed this line from: Changed this line from: Not sure if this is how it is supposed to be, but it seems that the
|
3640789
to
840b6cb
Compare
It was a draft (not yet done), not sure what about your fixes, but they seem to be workarounds. I did rework whole walking system just now, so let me know if this is now better than it was before. One important thing to note for all other testers, you have to disable BOT_PROTECTION macro, because of the g_game.walk call from lua side. Explained it in #1037
|
840b6cb
to
00f37cb
Compare
simple test
|
00f37cb
to
dd131c6
Compare
I will also take a look at how sudden speed changes behave with these changes, because before it was very buggy. |
Insignificant detail lvl 73 PR otcrmoonwalking Video.movvs v8bandicam.2025-01-13.19-48-19-654.mp4vs cipsoftbandicam.2025-01-13.21-00-11-646.mp4 |
Environmentclient: 13.20 Test resultsfirst step: (rest of tests were taken with bot protection off) Tests were repeated on Ubuntu dedicated server connecting with Windows client (ping: 30ms), same server engine. Results: OK (except for bot protection "on") |
8d039b0
to
619b3c0
Compare
With these latest changes, I'm happy to inform that almost all issues I previously had with the walking being laggy and unresponsive have been solved. Therefore, first things first: awesome work @nekiro and thank you! However, I am still getting an extra step after a key is no longer being pressed and stutters when changing directions quickly. Here's a video of what I mean: 2025-01-14_16-39-20.mp4If I implement this change to
|
Does not reproduce for me on latest tfs master with 100-150 ping. |
I'm playing on a 10.41 protocol/client version TFS1.0-based server with 150~180 ping. |
I'm no longer using the code you mention to change. This code was rewritten and looks different now. I tried with delay of 150-180 and still no walk back is happening for me. I'll try with program to delay my localhost network, so maybe I can reproduce it. |
My apologies, @nekiro. I'm glad to report that after correctly pulling the latest changes from this PR, walking is working completely fine. No more issues, and controlling the character feels a million times better than before. No lag, no key press delay, no extra steps, no stutters when changing directions. All issues I was having with walking have been solved. Thank you very much. |
OTClient.-.Redemption.2025-01-14.18-40-53.mp4@nekiro but if it's ok for everyone, we'll merge it without any problems. |
Can't see in video, but this pull request still need changes for sudden speed changes, so not ready to merge yet. |
2025-01-14.18-57-56.mp4I recorded it now with OBS, I think it's better, pay attention to the houses, the camera keeps shaking. but in the video it is almost imperceptible. |
in my particular case Client: this PR GL. I don't notice the “camera is stuttering”. |
@nekiro @kokekanon |
It should be good, the only thing we can be afraid of is cpu usage with that fast repeat |
setRepeat would only be for that key that the player would be pressing at that moment, when he released it, it would return to the normal state, so I believe it won't have much cost. @nekiro |
I believe this is ready to be merged. I did not work out the speed change bugs (they are the same as they were before these changes so it's okay), because I can't currently invest more time into it, so we can create a new issue for it (I think there is one already for it though #963). |
72ef9c8
to
2068159
Compare
Quality Gate passedIssues Measures |
@kokekanon @luanluciano93 @Zbizu @BastardofWinterfell Guys, can you test it? |
canary 13.40 locally, working as expected, now it will be necessary to test on other protocols. |
Description
More smooth, better, refactored walking
Behavior
Actual
Walking is laggy
Expected
Should be smooth
Fixes
Fix #1027
Type of change
Please delete options that are not relevant.
Checklist