Colyseus Unity3d

by gamestdio

Multiplayer Game Client for Unity

( Crawled 31 minutes ago )


Multiplayer Game Client for Unity.

Join the chat at Donate

C#/Unity client for Colyseus Multiplayer Game Server.


Copy Assets/Colyseus into your project. See usage example.

Running the demo server

Ensure you have Node v6+ installed. Then run these commands in your commandline:

cd Server
npm install
npm start


Client colyseus = new Colyseus.Client ("ws://localhost:2657");

Room room = colyseus.Join ("room_name");
room.OnUpdate += OnUpdate;

Getting the full room state

void OnUpdate (object sender, RoomUpdateEventArgs e)

Listening to additions on state

room.state.Listen ("players", "add", OnAddPlayer);
void OnAddPlayer (string[] path, MessagePackObject value)
    Debug.Log ("OnAddPlayer");
    Debug.Log (value);

Listening to updates on state

room.state.Listen ("players/:id/:axis", "replace", OnPlayerMove);
void OnPlayerMove (string[] path, MessagePackObject value)
    Debug.Log ("OnPlayerMove");
    Debug.Log ("playerId: " + path[0] + ", axis: " + path[1]);
    Debug.Log (value);

Listening to deletions on state

room.state.Listen ("players/:id", "remove", OnPlayerRemoved);
void OnPlayerRemoved (string[] path, MessagePackObject value)
    Debug.Log ("OnPlayerRemoved");
    Debug.Log ("playerId: " + path[0]);

Building for Windows Store (Universal 10 / UWP)

Build steps for UWP:

  • rename Colyseus/MsgPack/MsgPack.dll to something like MsgPack2.dll.
  • rename Colyseus/MsgPack/MsgPackUWP.dll to MsgPack.dll

Otherwise, build process for Windows Store (Universal 10) will fail because the MsgPack-namespace can't be found. The Unity Player however should work as expected after this, despite the renaming.