Comments (15)
Hi @niklaswolf, thanks for sending the sources. I hope to find some time during this week to check it out. Sorry.
from colyseus-unity-sdk.
I'll investigate during this week!
from colyseus-unity-sdk.
facing same issue :(
from colyseus-unity-sdk.
Sorry @lonewolfaka9 @quanglam68,
I believe the bad code example (server-side) was causing this problem. It was removing all user data after 5 seconds: f349f3b#diff-b144d0c249b359c454ed45edd9ef619d
Please let me know if this occurs to you even after removing those lines.
from colyseus-unity-sdk.
@endel same issue here :(
I am using the colyseus-starter template for the server and modified it, so unfortunatly I don't think this was the problem :/
The error occurs when the first patch is beeing processed. The first full state Exchange is working fine, an I get the following on the Client side:
{ "players" : [], "messages" : [] }
Now I'm adding a new Player in the onJoin-method of the Server and get the following on the Server:
StateHandler {
players: [ SJCHVwPCl: Player { xPosition: 0, yPosition: 0, zPosition: 0 } ],
messages: [ 'SJCHVwPCl joined!' ] `
}
Looking good so far!
But when it's trying to apply the patch client-side, the described error occurs...
from colyseus-unity-sdk.
I investigated a bit further:
The above does NOT work in the JS-Client, too. It gives an empty Players-property.
What I then tried was too get rid of the Player-reference in the state and added a simple String ('adv') instead, so I got the following on the Server
StateHandler {
players: [ Skws5wP0g: 'adv', S1V0cvv0l: 'adv' ],
messages:
[ 'Skws5wP0g joined!',
'S1V0cvv0l joined!' ]
}
This didn't work either on the JS-Client. It gave the same empty Players-property.
Then I tried to get rid of the object/Array completely, because the Messages-property was working fine.
So server-side it looked like this:
StateHandler {
players: [ 'B1grovPAx', 'rkmUjwwCx'],
messages:
[ 'B1grovPAx joined!',
'rkmUjwwCx joined!',
] }
This worked indeed on the JS-Client. But the Unity/C#-Client gives the same error as described.
Maybe this helps while investigating ;)
from colyseus-unity-sdk.
@niklaswolf Do you have the project using the JavaScript client so I can have a look at? If you can also share your Unity/C# project would be great. I'd like to investigate further. Thanks
from colyseus-unity-sdk.
@endel
Server: https://mygit.th-deg.de/nw17904/colyseus-server
JS-Client: https://mygit.th-deg.de/jl01849/WebVR (actually maintained by a colleague of mine)
These two are hosted on our Universitys gitlab, but we made them public, so you should be able to clone them ;)
Unity: https://github.com/niklaswolf/colyseus-unity3d (this is adapted for UWP, but it works in Unity-Editor, too. The error is also showing up in Unity-Editor ;))
Sorry for the bad code in some places, but these projects are in very early development-stage (as you'll see)
from colyseus-unity-sdk.
@niklaswolf unfortunately, I don't have rights to clone these repositories. Do you mind sending them to me at endel.dreyer [at] gmail.com? Thanks!
from colyseus-unity-sdk.
@endel
I just sent you an email ;)
from colyseus-unity-sdk.
Any news on this? :)
from colyseus-unity-sdk.
Yup, the error is still happening. 😢
Here's a report of what I could find:
- The error never occurs for the first client.
- The problem happens when the second client receives the first patch message from the server.
- I believe the root cause of the issue on
Room#SetState()
: https://github.com/gamestdio/colyseus-unity3d/blob/f349f3b55b41028f414aeed197262afc04a1976d/Assets/Colyseus/Room.cs#L93 - The client should have the latest encoded state (as
byte[]
of the msgpack object), to be able to apply patches against it later.
I've asked how to re-encode a MessagePackObject
into byte[]
here, as I couldn't find out how to do it: msgpack/msgpack-cli#234
Any help is very appreciated. :)
from colyseus-unity-sdk.
@endel I tried the suggestion the guy from msgpack made, and it seems to work! If you don't mind, I'll make a PR to include this solution! :)
from colyseus-unity-sdk.
@niklaswolf awesome. Sure, that'd be great! Thanks! :)
from colyseus-unity-sdk.
It's finally fixed! Thanks @niklaswolf for your pull-request! 🎉
from colyseus-unity-sdk.
Related Issues (20)
- JsonSerializationException when receiving a message from server in WebGL export HOT 14
- Can not export to WebGL
- Domain Reload support
- JsonSerializationException: Unable to deserialize instance of 'BgDataMessage' for iOS on device.. HOT 7
- Schema Backward Compatibility not working as expected HOT 2
- colyseus-unity-sdk-0.14.20 schema-codegen bug. HOT 3
- Problems with lobbyRoom and ColyseusRoomAvailable. HOT 4
- colyseus-unity-sdk-0.14.15 ->18 Example Error. HOT 2
- schema lost in reconnection situation HOT 2
- The 'onMesssage' in file 'Assets/Colyseus/Runtime/WebSocket/WebSocket.jslib' is wrong
- Colyseus.MatchMakeException: Unexpected end of JSON input HOT 2
- ColyseusManager destroy game object unexpected or have multiple instance when change scene HOT 3
- Unable to Join GameRoom after migrating to 0.15.3 Version Unity HOT 3
- Make OnJoin private
- OnStateChange Called When Current Value And Previous Values are same HOT 4
- about 0.15 state.player.listen("field", (value)) HOT 3
- ColyseusRoom.OnMessage<> throws exception if the sessionId exists
- Fixing ReconnectionToken Handling in Colyseus Unity SDK(Version 0.15.8) (FIXED)
- Imported UPM sample project has a compile error HOT 3
- Reflection and serialization issues between classes with the same number and type of fields HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colyseus-unity-sdk.