Skip to content
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

Adding spell pattern points when receiving packets from player instead of every tick #7

Closed
nullTheCoder opened this issue Jul 25, 2022 · 1 comment

Comments

@nullTheCoder
Copy link

Is your feature request related to a problem? Please describe.

Yes, incase of a player having packet loss some packets may arrive out of order making the server have to wait for the packets which should have arrived, during the waiting the player's head position will not be updated and when the packets in the middle finally arrive to the server the server will update player's head position to the latest one in less than a tick causing the player's head to jerk which can affect the player's ability to draw spell patterns.

an oversimplified example:

  1. Player tells the server that its head is looking at (0, 0).
  2. Server receives player's head position and sets it to (0, 0).
  1. The pattern recording code records position (0, 0)
  1. Player tells the server that its head is looking at (0.5, 1).
  2. The packet with player's position is lost.
  3. The server does not get player's head position.
  1. Player tells the server that its head is looking at (1, 0).
  2. The server's computer gets player's position (1, 0).
  3. The server's computer realises that it did not receive a packet which was in the middle so it does not pass the packet to the Minecraft server yet.
  1. Player understands that the server did not get the packet.
  2. Player resends the packet where its head position is (0.5, 1).
  1. Server's computer gets the packet where players position is (0.5, 1)
  2. Server's computer sends both packets in the order (0.5, 1), (1, 0) to the Minecraft server.
  1. Server receives packet where player's head position is (0.5, 1)
  2. the server sets player's position to (0.5, 1)
  3. In less than a tick after that the server receives packet where player's head position is (1, 0)
  4. the server sets player's position to (1, 0)
  1. The pattern recording code records position (1, 0)
  1. The player instead of getting a triangle [(0, 0), (0.5, 1), (1, 0)] gets a line [(0, 0), (1, 0)]
  2. The player which was unable to cast its spell dies to a zombie which the its spell was supposed to kill.

Describe the solution you'd like

Instead of recording player's position on tick record it when the Minecraft server receives player look packet

Describe alternatives you've considered

Ignore this problem because it requires NMS to solve it.

@M0rica
Copy link
Owner

M0rica commented Aug 6, 2022

Thank you for reporting this problem, I wasn't aware of that! However, I want to leave NMS out of this project if possible to maintain compatibility with other Minecraft versions. Also spell patterns require a good amount of recorded points and the system can correct small mistakes in some cases. So if high package loss impacts your spell casting abilities, it will probably be difficult to play on the server in general so that spell casting isn't your main issue I think.
So I'd like to ignore this problem for now, if it becomes a bigger issue at some point I will fix it.

@M0rica M0rica closed this as completed Oct 28, 2022
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

No branches or pull requests

2 participants