Fix player position desync during movement#770
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the synchronization between server and client movement by replacing static movement delays with a dynamic calculation model. By accounting for player equipment, terrain, and active status effects, the server can now accurately predict and validate movement, reducing desync issues and forced corrections. Additionally, the update includes minor quality-of-life improvements regarding combat restrictions in safe zones and reduced network traffic by optimizing walk packets. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors movement logic to calculate step delays dynamically based on character state, including equipped items like wings and pets, active magic effects such as Iced and Blow of Destruction, and terrain features like safezones and diagonal paths. It also introduces the Blow of Destruction effect and implements safezone attack restrictions. The review feedback highlights a bug in the packet size calculation for movement updates where the buffer length is used instead of the actual step count. Additionally, it is recommended to use enums for magic effect constants to improve maintainability and to resolve an inconsistency in diagonal movement factors between monsters and players.
a4d9acc to
7aaddf5
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements a more sophisticated movement speed system for players and monsters, accounting for active magic effects like Iced and Blow of Destruction, as well as various equipped items such as wings and pets. The Walker component was refactored to support dynamic step delays, and a safezone check was added to prevent unauthorized attacks. Review feedback points out that the logic for applying movement speed penalties needs adjustment to ensure the strongest slow effect takes precedence in both the Monster and Player classes. It was also suggested to use constants for speed factors in the Player class to maintain consistency with the Monster implementation.
db85751 to
e533f18
Compare
|
Hey @sven-n and @itayalroy! My suggestion is that my PR gets merged first. That way @itayalroy can drop the changes to the files in /Persistence. It will also save him the hassle of creating the update plugin 😛 |
The current Walker implementation is not aligned to client-side movement- it uses wrong movement speeds and does not account for many parameters that client takes into account when calculating player/monster movement speed (safezones, boots, wings, pets, mounts, diagonal tiles, skill effects such as ice/strike of destruction etc). As a result, server and client positions of players/monsters frequently go out of sync, which causes the server to reject valid walk requests, and send forced move corrections back, causing a flaky movement experience overall.
This PR refines server-side player/monster movement by calculating walk delays per step accounting for movement speed modifiers (safe zones, wings, pets, boots, gloves, Fenrir, ice, strike of destruction, etc) instead of using one fixed inaccurate delay.
It also includes 2 other movement related minor fixes: