Open TarunPhonato opened 1 year ago
Hi @TarunPhonato, could you please provide a small project that reproduces this issue? (with code for both server and client)
Hello Endel,
I have attached a small project that reproduces this issue (with code for both server and client). Please look into it.
- Issue Points :- -When Current Value And Previous Values are the same, why did I receive OnStateChange callback at the same time ( LGameManager. PawnOnStepsMovedChange) -When resetting value of stepsMoved to -1 after reaching to 57 the change is not getting triggered on client side
Client Side :- Unity version: 2020.2.2f1 Colyseus SDK version : 0.15.4
Server Side :-* Node JS version : v14 .17.6 Colyseus SDK version : 0.15.6
Testproject.zip https://drive.google.com/file/d/1dhKc7DD7Yd41kYT_xiTkC8rvhDEOsNpr/view?usp=drive_web
TestServer.zip https://drive.google.com/file/d/159QMJ27DlepgeAVXYea8ar5xGpSvXhmS/view?usp=drive_web
Hi @TarunPhonato, thanks for the reproduction scenario.
I can confirm the misbehavior - they're 2 known-issues from the state sync structures (aka schemas):
currentValue
and previousValue
are the sameThis is due to the usage of experimental filters. I'd suggest treating this edge case on your end. (There are plans on replacing the current filter
/filterChildren
implementation with a different solution - filters are going to be slowly deprecated in the future)
This can happen when the same schema instance is being re-used in many places within the state. I've just created an issue describing the problem here.. One easy way to fix this, is by calling instance.clone()
instead of sharing the same instance.
This issue does not happen when cloning the instances, only when sharing the same instance - which will result in the instance being shared on the client-side as well.
I see you work for Phonato Studios, it would be great if you can convince them to sponsor the project, if the company is benefiting from Colyseus 🙏
Cheers, I hope this helps, and let me know if you have any other questions
Thanks for the Help!
Actually we are starting a new project. I will talk to management regarding sponsors.
On Tue, Aug 22, 2023 at 7:16 AM Endel Dreyer @.***> wrote:
Hi @TarunPhonato https://github.com/TarunPhonato, thanks for the reproduction scenario.
I can confirm the misbehavior - they're 2 known-issues from the state sync structures (aka schemas): 1) The re-triggering of events, even if currentValue and previousValue are the same
This is due to the usage of experimental filters. I'd suggest treating this edge case on your end. (There are plans on replacing the current filter/filterChildren implementation with a different solution https://github.com/colyseus/colyseus/wiki/Public-Roadmap#colyseus-framework
- filters are going to be slowly deprecated in the future) 2) The callback is not being triggered on the client-side
This can happen when the same schema instance is being re-used in many places within the state. I've just created an issue describing the problem here. https://github.com/colyseus/schema/issues/151. One easy way to fix this, is by calling instance.clone() instead of sharing the same instance.
This issue does not happen when cloning the instances, only when sharing the same instance - which will result in the instance being shared on the client-side as well.
I see you work for Phonato Studios, it would be great if you can convince them to sponsor the project, if the company is benefiting from Colyseus 🙏
Cheers, I hope this helps, and let me know if you have any other questions
— Reply to this email directly, view it on GitHub https://github.com/colyseus/colyseus-unity-sdk/issues/217#issuecomment-1687289488, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAFSD4BDGGLHYPSPYXOE6QDXWQFNRANCNFSM6AAAAAA3T6MBWM . You are receiving this because you were mentioned.Message ID: @.***>
-- Regards Tarun Kumar
When Current Value And Previous Values are same why I received OnState Change callback on same time.
It's working fine while playing on Unity Editor. Unity version : 2020.2.2f1 Colyseus SDK version : 0.15.4