fabsk7 / AgarioFacebook

Testes de multiplayer com um jogo simples como agario e a api do facebook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

colyseus.js

Multiplayer Game Client for Unity.

Join the chat at https://gitter.im/gamestdio/colyseus Donate

C#/Unity client for Colyseus Multiplayer Game Server.

Installation

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

Usage

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)
{
	Debug.Log(e.state);
}

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.

License

MIT

About

Testes de multiplayer com um jogo simples como agario e a api do facebook

License:MIT License


Languages

Language:C# 76.9%Language:ASP 21.1%Language:Smalltalk 1.2%Language:JavaScript 0.2%Language:HTML 0.2%Language:CSS 0.1%Language:TypeScript 0.1%