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
SchemaSerializer
in the server-side. - See how to listen for changes in the state using
SchemaSerializer
.
Client-side¶
colyseus-unity3d¶
client.id
has been renamed toclient.Id
room.id
has been renamed toroom.Id
room.name
has been renamed toroom.Name
room.sessionId
has been renamed toroom.SessionId
room.state
has been renamed toroom.State
e.message
has been renamed toe.Message
(onMessageEventArgs
andErrorEventArgs
)RoomUpdateEventArgs
has been renamed toStateChangeEventArgs
e.state
has been renamed toe.State