-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0.0: Planned changes #75
Comments
@endel, one thing with a high value and relatively low development effort would be directly supporting objects in the Schema without having to store them serialized. |
Hi @virtumonde, not sure if I understand what do you mean, you mind providing an example of how this could look like? |
@endel, that was not a very good description. What I mean is being able to store objects in the Schema. As of now, the only way I was able to do so is by using JSON.stringify() and then retrieving using JSON.parse(). I know that you can store instances of classes provided that you specify what class is the given instance but I didn't find ways to store objects directly without any dancing around the serialization. |
If I am right and there is no way to directly introduce untyped objects (not class instances) into Schema without JSON.stringify() then it would be extremely helpful if Colyseus would do the JSON.stringify()/JSON.parse() thing automatically somehow (I think this makes sense to do from the side of the client). |
From what I gather, serializing exists to compress your objects, so less bytes are transferred. Just doing Edit: also, with serialization Colyseus is able to tell which exact properties changed and send an update only for that single property (less bytes to send!). With non-serialized object, there's no way of precisely telling which part of it changed and when, so I imagine we would need to dump that whole object down the pipe. |
I was going to say exactly what @Zielak mentioned. The major problem would be detecting changes inside an untyped structure, and adding more dependencies to the decoder. The built-in JSON decoder from Unity is quite limited, and wouldn't support decoding without having some extra types in the client-side for the particular structure. Msgpack could be used for this instead of JSON - but this would make the decoder coupled to a dependency, right now the |
What I need is storing objects in the state in a way that is compatible with serialization, then. I cannot do this with a Map because the Shema accepts only one type, I cannot use the type | type | type syntax as in Typescript. |
Hi guys, I've been tinkering on the changes necessary to improve the overall usage of
@colyseus/schema
(a.k.a. state serializer) and here's the list of open issues I'm planning to close on the1.0.0
update:This is going to require restructuring and rewriting some parts of the encoder and decoder across all languages, the plan is to be able to release it next month.
Another big change is the client-side callbacks. They are currently triggered one by one, before the full patch is applied on the client's state. It would be better if the callbacks are triggered after the client received and updated its local state.
If you have any suggestions or feedback to give regarding how the
@colyseus/schema
works, or could work differently - this is the right moment. Decisions made during next month will live probably for the next year or so.Thanks!
The text was updated successfully, but these errors were encountered: