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

Out of range error when flying around with more than one client connected #25

Open
ozzt opened this issue May 13, 2019 · 3 comments
Open

Comments

@ozzt
Copy link

ozzt commented May 13, 2019

RangeError [ERR_OUT_OF_RANGE]: Serialization error for toClient.position_update.change_in_y : Write error for params.position_update.change_in_y : The value of "value" is out of range. It must be >= -128 and <= 127. Received 136
    at writeU_Int8 (internal/buffer.js:559:11)
    at Buffer.writeInt8 (internal/buffer.js:690:10)
    at ProtoDef.writer (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\datatypes\numeric.js:69:25)
    at ProtoDef.write (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\protodef.js:117:29)
    at tryDoc (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\datatypes\structures.js:64:23)
    at tryCatch (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\utils.js:50:16)
    at tryDoc (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\utils.js:54:10)
    at typeArgs.reduce (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\datatypes\structures.js:64:5)
    at Array.reduce (<anonymous>)
    at ProtoDef.writeContainer (C:\Users\ozzt\Documents\test\dazed-sheep\node_modules\protodef\src\datatypes\structures.js:63:21)

How to reproduce

  1. Join local server with 2 clients
  2. Fly around
  3. Errors will be spammed in the console and the player will disappear from the other client

The error doesn't occur if there's only one client connected to the server.
Reproduced on ClassiCube 1.0.3 beta and dazed-sheep 1b6fb0f node.js v10.15.0

Thanks.

@ozzt
Copy link
Author

ozzt commented May 14, 2019

To work around this, I am currently using teleport_player which accepts an absolute position unlike position_update.

@ghost
Copy link

ghost commented May 15, 2019

This is kind of wack, I don't understand how a movement packet could have a change that is greater than 128 in a single movement packet -- yet I think you can solve this by clamping the value from -127 to 128? Unless this is a more deeply rooted bug. I'm not currently maintaining this project but I'd be thankful if you'd send a pull request fixing this issue (if my aforementioned idea fixes the issue [make sure you do the same to the other values as well])

@ghost
Copy link

ghost commented Jun 27, 2020

Following up: this is supposed to be solved by splitting the movement into movement packets that sum up to the total delta. For example, 136 would result in a packet of 128 being sent, then a packet of 8.

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

1 participant