Skip to content

Fix player position desync during movement#770

Open
itayalroy wants to merge 3 commits into
MUnique:masterfrom
itayalroy:player_movement
Open

Fix player position desync during movement#770
itayalroy wants to merge 3 commits into
MUnique:masterfrom
itayalroy:player_movement

Conversation

@itayalroy
Copy link
Copy Markdown
Contributor

@itayalroy itayalroy commented May 9, 2026

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:

  • Blocks player attacks when either side is protected by a safe zone.
  • Stops sending walk direction data by default, since MuMain no longer uses it.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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

  • Movement Logic Refinement: Replaced fixed movement delays with dynamic calculations that account for various speed modifiers, including safe zones, wings, pets, and specific skill effects like 'Iced' or 'Strike of Destruction'.
  • Safe-Zone Combat: Implemented a check to block player attacks when either the attacker or the target is located within a safe zone.
  • Packet Optimization: Disabled the default transmission of walk direction data, as the client no longer requires this information for path calculation.
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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@itayalroy itayalroy changed the title Refine movement timing, safe-zone combat, and walk packets Fix player position desync during movement May 9, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/GameServer/RemoteView/World/ObjectMovedPlugIn.cs Outdated
Comment thread src/GameServer/RemoteView/World/ObjectMovedPlugInExtended.cs Outdated
Comment thread src/GameLogic/NPC/Monster.cs
Comment thread src/GameLogic/NPC/Monster.cs Outdated
Comment thread src/GameLogic/Player.cs
@itayalroy itayalroy force-pushed the player_movement branch 2 times, most recently from a4d9acc to 7aaddf5 Compare May 9, 2026 22:05
@itayalroy
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/GameLogic/NPC/Monster.cs
Comment thread src/GameLogic/Player.cs
Comment thread src/GameLogic/Player.cs
@ze-dom
Copy link
Copy Markdown
Contributor

ze-dom commented May 11, 2026

Hey @sven-n and @itayalroy!
I also added the strike of destruction magic effect (cold) in my PR. (It is also used for the RF's Chain Drive skill). I don't know what will be merged first, but this can create a conflict.

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 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants