Migrating to version 0.10.x (from 0.9.x)¶
TODO
Server-side¶
EntityMap<T>has been removed. If you're usingEntityMap<T>to describe a map of entities, you should use the plain TypeScript alternative now. e.g. Replace "EntityMap<Player>" with "{[id: string]: Player}".
New default serializer¶
Colyseus 0.10 has introduced a new serialization method (SchemaSerializer). Even though it's recommened to use the new serializer, you can continue using the previous one (FossilDeltaSerializer).
I want to continue using the previous serializer¶
No problem, check below how to continue using the previous serializer using TypeScript or plain JavaScript.
import { Room, FossilDeltaSerializer, serialize } from "colyseus";
@serialize(FossilDeltaSerializer)
class MyRoom extends Room {
// your room definition
}
const colyseus = require('colyseus');
class MyRoom extends colyseus.Room {
// your room definition
}
colyseus.serialize(colyseus.FossilDeltaSerializer)(MyRoom);
I want to migrate to the new serializer¶
Great, hopefully you won't have to make many changes in your project. In the client-side, the way to listen for state patches has changed slightly.
- See how to use the new
SchemaSerializerin the server-side. - See how to listen for changes in the state using
SchemaSerializer.
Client-side¶
colyseus-unity3d¶
client.idhas been renamed toclient.Idroom.idhas been renamed toroom.Idroom.namehas been renamed toroom.Nameroom.sessionIdhas been renamed toroom.SessionIdroom.statehas been renamed toroom.Statee.messagehas been renamed toe.Message(onMessageEventArgsandErrorEventArgs)RoomUpdateEventArgshas been renamed toStateChangeEventArgse.statehas been renamed toe.State