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

Client side player.id is appended with NaN after interpolation #13

Open
EmersonYe opened this issue Apr 12, 2020 · 0 comments · May be fixed by #14
Open

Client side player.id is appended with NaN after interpolation #13

EmersonYe opened this issue Apr 12, 2020 · 0 comments · May be fixed by #14

Comments

@EmersonYe
Copy link

Summary:

NaN is appended to player.id on the client-side after interpolation. This happens after the second update is received from the server (i.e. the first time interpolation is performed).

Steps to reproduce:

  1. Add console.log(me.id); to the start of the render() function in src/client/render.js.
  2. Start the server with npm run develop from the command line.
  3. Visit localhost:3000.
  4. Open dev tools (ctrl + shift + j on Windows).
  5. Join the game by clicking on PLAY.

Expected results:

My socket id (e.g. ljLSqzmUSc5ZGEf5AAAC) is logged to console repeatedly.

Actual results:

  1. My socket id is logged to console 6 times (e.g. ljLSqzmUSc5ZGEf5AAAC).
  2. My socket id appended with NaN (e.g. ljLSqzmUSc5ZGEf5AAACNaN) is logged to console repeatedly.

Additional information:

I encountered this bug when trying to implement a chat feature. Each chat object had a reference to it's parentId without NaN appended to it. I was unable to match chat objects to players in the render() function in src/client/render.js because the player id's had changed to have NaN appended to them.

@EmersonYe EmersonYe linked a pull request Apr 12, 2020 that will close this issue
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 a pull request may close this issue.

1 participant