Open mrosati84 opened 1 week ago
Hi Matteo 👋 Thank you for the kind words 💙
I've just tried splicing a single item and it seems to be working. Do you mind sharing a reproduction scenario? There are a few known issues regarding ArraySchema
, you may be experiencing one: https://github.com/colyseus/colyseus/issues/641
I'll go ahead and suggest a workaround:
this.state.projectiles.splice(index, 1);
this.broadcastPatch(); // consume/broadcast the changes immediately
There's a major refactoring of schemas going on https://github.com/colyseus/colyseus/issues/709, I'm currently finishing one last issue before releasing Colyseus 0.16 and v3 of schemas. Initially, only the JavaScript SDK will be supported, and as things are stable, other SDKs will be implemented as well!
Cheers!
hey endel,
you should be able to access the game repo here: https://gitlab.com/mrosati/defold-real-time-multiplayer
to reproduce, you need to perform a few steps:
projectiles
branchserver
directorythe parts you might want to look are:
server\src\rooms\schema\MyRoomState.ts
the remove_projectile
method.lib\multiplayer.lua
line 152 the on_remove
callback.again, the callback works if i don't use splice
and i use something like pop
in Colyseus.
Also, i have tried the this.broadcastPatch()
method, and it seems to solve the issue, but I understand it should not be invoked under normal circumstances right?
EDIT: even by using this.broadcastPatch()
the callback is invoked very inconsistently, so it's not very reliable either.
Thanks! Matteo
Hi and first of all THANK YOU for this great project. i love it!
I might have encountered an issue.
I'm running a Defold project, and I'm experiencing an unexpected result when trying to remove an item from ArraySchema using the splice method, as suggested in the documentation.
Here's a snippet of my code of my room state class:
this code works like a charm when inspecting the state in Colyseus, however this is not triggering the on_remove on my Defold code:
but strangely, this callback in Defold actually works if i use for instance the
pop()
method in Colyseus (here's the modified code)of course i can't use
pop()
for my intent because i need to remove a specific item.Have i found an issue or am i doing something wrong here?
Thanks! Matteo