GitHub Documentation Patreon donate button

Colyseus v0.12 - v.013 MapSchema issue



  • Hello after migration on v0.12 or v.0.13 I faced with the same issue.
    If I call delete from MapScheme and immediately add a new value I did not receive new added value:

    Map state after connection player A to server:
    {
    playerAId: PlayerAEntity
    botId: BotEntity
    }

    After connecting player "B" I delete BotEntity from map and immediately add PlayerBEntity on server side inside method onJoin, but got on player B client side map state as bellow:
    {
    playerAId: PlayerAEntity
    }

    But player A client have correct map state:
    {
    playerAId: PlayerAEntity
    playerBId: PlayerBEntity
    }

    Handling code:
    onJoin(...) {
    ...
    delete this.state.players[botId];
    this.state.players[playerAId] = PlayerAEntity;
    ...
    } // I tryed change operations order but it has no effect

    Colyseus v0.11 doesn't have such a problem.
    Could you take a look please?


  • administrator

    Hi @kukuts, thanks for reporting, is this issue you're having similar to this? https://github.com/colyseus/schema/issues/71

    If the key of the map you're deleting/creating is the same, I'm afraid you'd need to do some workaround in the meantime, I'm planning to fix most of @colyseus/schema annoyances here, which should be released in a few weeks https://github.com/colyseus/schema/issues/75

    Cheers



  • @endel thanks for quick reply, but keys of map are different. For player I use sessionId and nanoid for bot key.



  • @endel Hi, is there any progress with fix the problem and a new release?


  • administrator

    Hi @kukuts, I'm working hard on @colyseus/schema#75 since last month, I'm expecting an "alpha" release someday next week, it would be great if you can jump in to help us test this new version. There are some small differences from latest stable version to the new one which I'm going to document to help everyone migrate. 🙏



  • @endel I’ll be happy to help with test, keep me posted please inside this thread.


  • administrator

    Hi @kukuts, thanks for your availability for testing the alpha version.
    If you're using the JavaScript client (colyseus.js), you can try out the beta versions at:

    • colyseus@0.14.0-alpha.5 (server)
    • colyseus.js@0.14.0-alpha.4 (client)

    For short, you can install them using:

    • npm install colyseus@alpha --save
    • npm install colyseus.js@alpha --save

    Hopefully, ALL MapSchema issues should be gone now. There are some small API changes though, mostly regarding iterating through MapSchema values and/or its keys, and getting its length. Here's the upgrading guide so far: https://deploy-preview-45--colyseus-docs.netlify.app/migrating/0.14/


 

© 2020 Endel Dreyer