Skip to content

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

@EmersonYe

Description

@EmersonYe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions