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.


 

GitHub Documentation Patreon donate button

© 2020 Endel Dreyer