Code Monkey home page Code Monkey logo

colyseus's Introduction



Discussion forum

Multiplayer Framework for Node.js.
View documentation

Colyseus is an Authoritative Multiplayer Framework for Node.js, with SDKs available for the Web, Unity, Defold, Haxe, Cocos and Construct3. (See official SDKs)

The project focuses on providing synchronizable data structures for realtime and turn-based games, matchmaking, and ease of usage both on the server-side and client-side.

The mission of the framework is to be a standard netcode & matchmaking solution for any kind of project you can think of!

Key features:

  • WebSocket-based communication
  • Simple API in the server-side and client-side.
  • Automatic state synchronization from server-to-client (delta compressed)
  • Matchmaking clients into game rooms/sessions
  • Scale vertically or horizontally

See public roadmap for future plans.

🚀 Quickstart

Create a bare-bones Colyseus server by using npm create colyseus-app@latest:

npm create colyseus-app@latest my-colyseus-server
cd my-colyseus-server
npm start

Sponsors

The sustainability of the project relies on Colyseus Cloud subscriptions and sponsorships. If you are not using Colyseus Cloud, please consider sponsoring the project 💖

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Aymeric Chauvin

💬 💡

Brian Hay

🖋

Damian A. Pastorini

💬 📖 🐛

Darek Greenly

💬 🐛 💻

David Rydwanski

💬 💻

Dr. Burton

🧑‍🏫

Endel Dreyer

💻 📖 💡

Enriqueto

💼

Fazri Zubair

💼

Federico

🐛 💻

James Jacoby

💬 💡 🖋

Jonas Voland

💬 🐛 💻 🤔 💡

Kyle J. Kemp

💬 🐛 💻 🤔

Luke Wood

💬 🐛 💻

Milad Doorbash

🐛 💻

Nikita Borisov

🐛 💻 💼 🤔

Phil Harvey

📖

Sergey

🐛 💻

Tom

💬 🐛 🤔

Tommy Leung

🧑‍🏫

digimbyte

📖

This project follows the all-contributors specification. Contributions of any kind are welcome!

Contributing

We encourage you to contribute to Colyseus! Please check out the Contributing guide for guidelines about how to proceed. Join us!

Everyone interacting in Colyseus and its sub-projects' codebases, issue trackers and chat rooms is expected to follow the code of conduct.

License

MIT

colyseus's People

Contributors

afrokick avatar allion-lahirup avatar carlosfusion avatar endel avatar federkun avatar giraffesyo avatar gitter-badger avatar greenkeeper[bot] avatar greenkeeperio-bot avatar heilmela avatar hnujxm avatar hunkydoryrepair avatar jblemee avatar kevinji avatar lightningk0ala avatar lpsandaruwan avatar lukewood avatar oyed avatar piamancini avatar rafaeor avatar rahatarmanahmed avatar rnd256 avatar ryanwillis avatar seiyria avatar terranblake avatar theweiweiway avatar tobspr avatar wenish avatar yncat avatar zglorb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colyseus's Issues

Match-making in a clustered environment

This question pops up often in the gitter channel. Currently there's no cluster support for Colyseus.

The rough idea is to separate match-making server from room handler (game session) processes:

  • Match-making should be a central unit to determine which server/node should the client join
  • Vertical scaling: Room handlers can live on multiple processes
  • Release version 0.5.0!

Any thoughts and ideas are welcome :)

An in-range update of ts-node is breaking the build 🚨

Version 3.0.5 of ts-node just got published.

Branch Build failing 🚨
Dependency ts-node
Current Version 3.0.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As ts-node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 7 commits.

  • c18331a 3.0.5
  • 5cf97b1 Add --inspect-brk to known flags (#343)
  • 7dfb3e3 Pin node tests at 6.x (#340)
  • 633d537 chore(package): update chai to version 4.0.1 (#337)
  • b751a56 Define exports and improve getTypeInfo help (#332)
  • d018300 Update yn default option
  • cc3bf22 Expose _ bin file for consumers to use

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

PM2 support

Supporting vertical scalability (#43) introduced the usage of the cluster module, and manual message passing between workers.

PM2 doesn't support message passing like this, though.

Problem when running with new workers implementation

Seems it losing context between processes or something ( I have told it to spawn several processes either). I'm just running forever start index.js and this error occures when the client tries to join. I'm using 0.7.0-alpha.3 on the client with: client.join('room'); , a note is that it works fine "localhost", this is behind an nginx. But tried the "stable" version and they worked fine with the nginx config. but got into some other problems with that. So would need to run the latest versions :)

data:    dist/index.js:6306 - process wants to communicate directly with pid (6320)
data:    dist/index.js:6306 - process 6320 is responding to JOIN_ROOM
data:    dist/index.js:6306 - process wants to communicate directly with pid (6321)
data:    dist/index.js:6306 - /var/www/c-c-c-combo/backend/node_modules/colyseus/lib/MatchMaker.js:85
data:    dist/index.js:6306 -         client.sessionId = clientOptions.sessionId;
data:    dist/index.js:6306 -                                         ^
data:    dist/index.js:6306 - TypeError: Cannot read property 'sessionId' of undefined
data:    dist/index.js:6306 -     at MatchMaker.onJoin (/var/www/c-c-c-combo/backend/node_modules/colyseus/lib/MatchMaker.js:85:41)
data:    dist/index.js:6306 -     at Server.<anonymous> (/var/www/c-c-c-combo/backend/node_modules/colyseus/lib/cluster/Worker.js:41:20)
data:    dist/index.js:6306 -     at emitOne (events.js:96:13)
data:    dist/index.js:6306 -     at Server.emit (events.js:188:7)
data:    dist/index.js:6306 -     at Server.emitConnection [as _upgradeCallback] (/var/www/c-c-c-combo/backend/node_modules/uws/uws.js:15:10)
data:    dist/index.js:6306 -     at Server.native.server.group.onConnection (/var/www/c-c-c-combo/backend/node_modules/uws/uws.js:465:18)
data:    dist/index.js:6306 -     at Socket.socket.on (/var/www/c-c-c-combo/backend/node_modules/uws/uws.js:502:32)
data:    dist/index.js:6306 -     at emitOne (events.js:101:20)
data:    dist/index.js:6306 -     at Socket.emit (events.js:188:7)
data:    dist/index.js:6306 -     at TCP._handle.close [as _onclose] (net.js:497:12)

React Native client?

Has anyone used this with react native as the client? Not sure exactly what would have to be done to make it work.

Make it transport in-dependent.

I think we should abstract out the transport layer details and make the transport details implementations in two adapters Reliable and Unreliable. This will work wonders for cases where you'd want to use WebRTC with SDP in UDP mode. Or in cases where you can make lower level UDP sockets to connect to the node instance directly.

Binding it to websocket adds TCP and HTTP overhead and has negative performance impact as TCP garuntees the packet order.

DTLS / SDP used in WebRTC present a great framework which can be used to communicate on non-reliable channels in browsers. Additionally, the webrtc identity architecture is a great way to use a 3rd party idp using standard protocols to authenticate via a separate context.

Support returning a promise from requestJoin

This would make it so you can hit a DB to see if a user is able to join a room. Particularly useful if you have a game with a continuous world where you move between maps, and you don't want players to sneak into maps they're not supposed to be on.

Exception on Room.disconnect()

I'm getting this exception when I do a room.disconnect();. Any idea what it could be?

  /app/node_modules/colyseus/lib/Utils.js:12 
      arr.length = len; 
                 ^ 
  RangeError: Invalid array length 
      at Object.spliceOne (/app/node_modules/colyseus/lib/Utils.js:12:16) 
      at MatchRoom.Room._onLeave (/app/node_modules/colyseus/lib/Room.js:145:17) 
      at /app/node_modules/colyseus/lib/Server.js:145:71 
      at Array.forEach (native) 
      at Server.onDisconnect (/app/node_modules/colyseus/lib/Server.js:145:33) 
      at process.nextTick (/app/node_modules/uws/uws.js:440:27) 
      at _combinedTickCallback (internal/process/next_tick.js:73:7) 
      at process._tickCallback (internal/process/next_tick.js:104:9)  

Allow to sending different room's state in function of the client.

I'm in need to sending different room's state in function of each client. The room contains "Red team" members and "Blue team" members. The red team will see just a portion of the room's state, so the blue team.

Right now I don't think there's a clean way to do it: you could manually filter the state for each client when you are broadcasting it using Room#send, without sending incremental patch, but that's inefficient and require more boilerplate code.

Is this use case something worth working on to add as feature in the next minor version, or it's something that you'd consider "too specific" to consider? How'd you handle this now?

Node https Module Support

I haven't fully had a chance to test whether it's my setup that's the issue, but in the meantime, I thought I'd open an issue to collate anything I find.

It's definitely a feature that is required in this day and age, especially once #49 is implemented.

Keep user state upon reconnection

Hi again :) , i am playing with https://github.com/endel/tic-tac-toe and i see that sometime one client maybe lost connection (While users are on the go, the data source will often switch towers and or downgrade/upgrade between 2G and 3G).
So i think if server hold the client session, then when client want to re connect, they can send that session id again to go to current playing room.
(i really do not know detail of that feature , but some where they are using ping and pong message between client and server to find if client lost connection or not)
It is very importance in real online game, so it is awesome if we have that feature!
Thanks so much!

Support horizontal scalability

Supporting vertical scalability (#43) introduced an architectural change that can be evolved to supporting horizontal scalability in the future.

Match-making should consider sessions living on different servers/processes to determine where the user should connect to.

Communication between servers/processes can be achieved by using either Redis or another message broker such as uTT

In order to achieve horizontal scalability, supporting PM2 for managing processes would be great to have first (#56)

Null and Undefined are incorrectly sent to clients

When I set a state property as undefined it receives it as a null, if I set a property as null in the server, the client receives a Object

Example:

room.ts

this.setState({ 
  shouldBeUndefined: undefined,   
  shouldBeNull: null     
});

In the client I get the following state

{
  "shouldBeUndefined": null,
  "shouldBeNull": {}
}

is colyseus suitable for turn base game?

Hi!
I am develop a turn base game (likes tic tac toe online). In game, users start match and play turn by turn, user move is limited by time (e.x 30 second each move) . And after some conditional, match over and then user start match again . So how can i implement this feature in colyseus server?
Thank so much!

A couple of general questions

Greetings, i've a several questions:

  1. I'm new to NodeJs and JS (Got previous experience with C#, Java and Cpp), but can you explain me, how to start frontend from a Tanx example? After executing "node start" in the root of tanx project, on listening port at localhost, all what i get is - "Cannot Get" and no frontend loaded.
  2. Second question is - is project discontinued? Haven't seen updated for a long time. We're looking for a completed server framework, for our game, and we found that Colyseus as very good canditate to this role.
    Thank you.

patched states are not broadcasted because previous and new states are always equal

I am quite a newbie in this, and I am looking for a solution to my problem.

using a custom StateHandler

myRoom.OnUpdate shows the snapshot of the room's state and it works fine and I can see changes in the state over time

but my clients do not receive any updates of the patched state
because in the Room.prototype.broadcastPatch function
currentStateEncoded.equals(this._previousStateEncoded) is always equal true,
so the patched state is never broadcasted

plz help!!!

Moving Client room-to-room

Is this possible? For example, having Rooms as Maps in an MMO game. Once a "door" is triggered, the room will move the player to the next specified room.

Add https compatibility to Server

As of now, interface ServerOptions asks for an http object. I would like it to accept https as well as http

Is it as easy as changing the interface definition to the following code?

import * from 'https';
export interface ServerOptions {
  server?: http.Server|https.Server;
  port?: number;
  ws?: WebSocketServer;
}

If so I'd be happy to make a PR. If you foresee other issues popping up, let me know and I can also make those changes.

Thanks!

An in-range update of @types/node is breaking the build 🚨

Version 7.0.7 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 7.0.6
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Separate HTTP server and Colyseus logic

Hello!

Is there a way to specify the HTTP server after configuring the game server logic?

With Socket.IO we can use the attach method:

var io = require('socket.io')();

// Then, in bin/www
io.attach(http);

If there isn't, could anyone guide me to what should be changed? I noticed the HTTP server is used to set the onConnect callback right in the constructor of the Server. Would changing this.server to a new WebSocketServer instance and adding this.onConnect as a callback to this new instance be enough?

Thanks!

Typescript

According to github,most of this is coded in typescript,does this mean users will have to use it for most of the functions that the engine provides or is using js solely feasible ?

Groups

Just sharing our email for everyone if they come across this...

Firstly, thanks for making a quick and handy websocket framework! I greatly appreciate the work you are contributing.

My question is having to do with groups in rooms, or multiple rooms. Can I explain my scenario and maybe you can tell me how to approach it?

In my game I would like to have multiple rooms available, max per room is 8 players. So how do I create rooms dynamically or find rooms that are available to join when a new player comes? Also, lets say after a match/game a player or two leaves the room (A), how can I put the remaining players in that room (A) into a new room (B) that is waiting? Does this make sense?

Are any of these tasks doable or what kind of approach do you suggest?

I would really appreciate your help and guidance on this (maybe a few snippets of code for example). I'm really new to web sockets, but have some experience with game dev. I just need some good examples for my situation to get going.

Thanks again!

The matchmaking will handle joining/creating rooms automatically. By setting the maxClients property to 8, whenever a new client tries to join that room, and all the available rooms are full, a new one will be created.

Unfortunately, currently, there's no way to redirect players from one room to another from the server. You could achieve this by manually making the client connect to a new room/session, in case the number of players is low, for example.

Moreover, from the client-side, there's no built-in method to retrieve the number of rooms available and number of clients connected to them. If you really need this feature, though, it shouldn't be hard to make it yourself - by exposing this data in a HTTP request, for example. (Discussion on this at #10)[https://github.com//issues/10]

Here's a an implementation to expose the rooms available in the server in a HTTP request, using the data already available in the server: (https://gist.github.com/endel/fcbee58cf35b081afb237b0b3e264e35)[https://gist.github.com/endel/fcbee58cf35b081afb237b0b3e264e35]

You can prioritize rooms with a higher number of players by returning a number (from 0 to 1) in the requestJoin method.

Construct 2

Does the construct 2 client have all the abilities of the basic js client,i know cs2 uses JS,but i'm not familiar with its api

Crash on Mobile Safari iOS 7.0 and below

The server crashes when running on Mobile Safari, under iOS 7.0 and below.

Server error:

colyseus/node_modules/msgpack-lite/lib/read-core.js:24
    if (!func) throw new Error("Invalid type: " + (type ? ("0x" + type.toString(16)) : type));
               ^

Error: Invalid type: 0x�

PM2: Problem starting server with 0.5.0-alpha.6

I'm getting the following error, the error is when running in pm2.
I have the following command to start: pm2 start index.js --node-args='--harmony --harmony-proxies --use-strict

1|index    | /var/www/c-c-c-combo/backend/node_modules/colyseus/lib/matchmaking/Process.js:68
1|index    |                 if (availableWorkerIds.length > 0) {
1|index    |                                       ^
1|index    | TypeError: Cannot read property 'length' of undefined
1|index    |     at Object.21837:1 (/var/www/c-c-c-combo/backend/node_modules/colyseus/lib/matchmaking/Process.js:68:39)
1|index    |     at Store.consume (/var/www/c-c-c-combo/backend/node_modules/memshared/lib/Store.js:25:47)
1|index    |     at process.workerHandleIncomingMessage (/var/www/c-c-c-combo/backend/node_modules/memshared/lib/index.js:31:19)
1|index    |     at emitTwo (events.js:111:20)
1|index    |     at process.emit (events.js:191:7)
1|index    |     at process.nextTick (internal/child_process.js:758:12)
1|index    |     at _combinedTickCallback (internal/process/next_tick.js:73:7)
1|index    |     at process._tickCallback (internal/process/next_tick.js:104:9)

My index.js looks like this:

import * as cluster from 'cluster';
import chatRoom from './rooms/chat_room';
import gameRoom from './rooms/game_room';
import highscoreRoom from './rooms/highscore_room';


const colyseus = require('colyseus');
const express = require('express');

const port = process.env.PORT || 3553;

const gameServer = new colyseus.ClusterServer();

gameServer.register('chat_room', chatRoom);
gameServer.register('game_room', gameRoom);
gameServer.register('highscore_room', highscoreRoom);
if (cluster.isMaster) {
  gameServer.listen(port);
} else {
  console.log('Worker spawned', process.pid);
  const app = express();
  // app.listen(port);

  // Create HTTP Server
  gameServer.attach({ app });
}

An in-range update of uws is breaking the build 🚨

Version 0.14.4 of uws just got published.

Branch Build failing 🚨
Dependency uws
Current Version 0.14.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

uws is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪

Status Details - ❌ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/gamestdio/colyseus/builds/226521448)

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Bottlenecks and children

Is their some type of upper limit of concurrent players a room can have?Could rooms be broken up into sub areas so that a player only sees things within a certain area rather than things within the whole room(world).

"not opened" log on socket disconnection

Hello,

when a client disconnects from the connection, colyseus throws this error:

Error: not opened
    at WebSocket.send (/home/simon/programming/fps/node_modules/ws/lib/WebSocket.js:218:38)
    at GameServer.broadcast (/home/simon/programming/fps/node_modules/colyseus/lib/room.js:163:34)
    at GameServer.broadcastPatch (/home/simon/programming/fps/node_modules/colyseus/lib/room.js:147:17)
    at GameServer.patch (/home/simon/programming/fps/node_modules/colyseus/lib/room.js:177:10)
    at Timeout.wrapper [as _onTimeout] (timers.js:421:11)
    at tryOnTimeout (timers.js:228:11)
    at Timer.listOnTimeout (timers.js:202:5)

Is this normal? Am I doing something wrong or do I should post more code in here?

Thanks for any help, Simon

Losing connection to room on unstable connection

Hey, Got into another issue. When the client has kinda flaky connection.

It seems it loses the connection to the room. But not the matchmaking socket, I'm getting the following error:
`MatchMaking couldn't process message: [ 13, 'SylUUMYDB-', { name: 'Patrik', score: 242 } ]``

In what cases would a _onLeave ( https://github.com/gamestdio/colyseus/blob/1ecc837de61eca913925cf9eb5a3da8f9704a41c/src/Room.ts#L192 ) trigger ? Cause it seems that's what's happening the "client" disconnects from the room. But then the messages are redirected to the "MatchMaking" socket.

Cause I guess I get into this comment: https://github.com/gamestdio/colyseus/blob/1ecc837de61eca913925cf9eb5a3da8f9704a41c/src/Room.ts#L204

 // TODO: force disconnect from server.
    //
    // need to check why the connection is being re-directed to MatchMaking
    // process after calling `client.close()` here

What would you suggested approach be to not lost the message on the server ? Cause I'm trying on the client "directly" room leave , join again .. but that doesn't seems to trigger / help.

Authentication

As of now Colyseus does not have any authentication step in built, so Marie can be Marie but is actually Jake! Lets make sure that Jake can't be Marie.

My proposal is as follows and assumes TLS

  • Upon initial connection the server sends a request_authorization event. Which has a nonce and a state.
  • Upon receiving the request_authorization the client fetches a JWT using an IdP and sends this JWT back authorization as the first event with the payload as a JWT.
  • The server validates the token
    • If the token is invalid or nonce/state failure occurs the server emits an authorization_error event and must close the connection immediately.
    • If the token is valid the server sends authenticated event and continues to initialize the client.

This will work just fine with #48 in future as any transport mechanism can implement this as the primary means of upgrading the connection.

The Token structure is tbd we need to consider what the user will be able to do (privileged access, etc, before we find the optimal token structure)

This flow does not account for IdP initiated flow. However, the match-making can still be moved to the identity provider which will resolve #43

[Question] Cluster support?

Heya! Does Colyseus supports multiple node instances running in a clustered environment? (e.g. pm2, node cluster, etc)?

Support for splitting and filtering views

Allow filtering the state before sending to specific clients - which should solve the current issue the framework has with a large amount of data in the state being sent to every client.

Related issue: #58

Match-making and Rooms API

Hi,
I think we should have mongo database for storing some data like:
-static rooms (Or lobby)

  • rooms count
  • number of players
  • user stats

And then we have api for drawing "lobby":

  • get number of active rooms
  • notify when any room dispose
  • notify when any room has user joining or left

How do you think? Thanks

Couldn't Run The Example Smoothly

Dear there,

When I tried the example:

git clone https://github.com/gamestdio/colyseus-examples.git
cd colyseus-examples
npm install
npm start

I sometime got this error and it stopped.
I couldn't find where it is coming form as well.

Error: connect ECONNREFUSED 127.0.0.1:80
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
worker 15136 died. Respawn.

Auto-reconnect colyseus.js to server

In my development environment, any time I save/restart the server (I'm using nodemon), it reboots. The client will disconnect and then I have to refresh the page to reconnect. In a live game, this means that if I push an update to the server every player will disconnect and not attempt to reconnect automatically.

Automatic reconnection (with exponential backoff configurable, as primus has) would help this a lot.

How does this differ to deepstream.io?

Hi,

I'm just doing some research right now about what libraries I should be using for a HTML5 MMOG (an .io game). I recently came across colyseus and I'm wondering how does it differ to deepstream.io, which is something similar to Firebase? Can the two be used together? Or do they conflict?

Thanks

Relation to peer-to-peer Colyseus?

Hi,
I've found this project by googling stuff related to this paper. I gave the source code a quick glance and it doesn't seem like this is an implementation of the network described in the paper. Is this an unfortunate name clash?

Upgrade to node v4 to avoid using --harmony

We shouldn't have to use --harmony on our applications to use Colyseus.
#4 should take care of this from a support standpoint, but Colyseus's own npm scripts and documentation still use --harmony. I don't want to send a PR removing those yet as that's a pretty opinionated thing, but I think it'd be good to move forward.

Is there anything preventing colyseus from requiring node v4+?

TypeError when "requestJoin" turns false

Using the colyseus-examples, with those changes:

import { Room } from "colyseus";

export class ChatRoom extends Room {

    onInit (options) {
        this.setState({ messages: [] });
        console.log("ChatRoom created!", options);
    }

+    requestJoin(options) {
+       const canJoin = this.clients.length < 2;
+      console.log('can join', canJoin, this.clients.length );
+      return canJoin;
+    }

    onJoin (client) {
        this.state.messages.push(`${ client.id } joined.`);
    }

    onLeave (client) {
        this.state.messages.push(`${ client.id } left.`);
    }

    onMessage (client, data) {
        this.state.messages.push(data.message);
        console.log("ChatRoom:", client.id, data);
    }

    onDispose () {
        console.log("Dispose ChatRoom");
    }

}

I get:

ChatRoom created! {}
can join true 0
can join true 1
process 6992 is responding to REQUEST_JOIN_ROOM
can join true 1
can join false 2
process 6992 is responding to REQUEST_JOIN_ROOM
/src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:100
                process.send([matchMakingPid, joinOptions.clientId, process.pid, room_1.roomId$ score_1]);
                                                                                       ^

TypeError: Cannot read property 'roomId' of undefined
    at /src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:100:88
    at Object.6992:6 (/src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:124:9$
    at Store.consume (/src/colyseus-examples/node_modules/memshared/lib/Store.js:25:47)
    at process.workerHandleIncomingMessage (/src/colyseus-examples/node_modules/memshared/lib/$ndex.js:31:19)
    at emitTwo (events.js:130:20)
    at process.emit (events.js:213:7)
    at handleMessage (internal/child_process.js:753:14)
    at Pipe.channel.onread (internal/child_process.js:472:11)
worker 6986 died. Respawn.
/src/colyseus-examples/node_modules/colyseus/lib/ClusterServer.js:47
                worker.send([Protocol_1.Protocol.PASS_WEBSOCKET, {
                      ^

What should be the expected behavior?

Implement Lua/CoronaSDK client

This is simple but awesome server for multi player game! Would you please support tcp udp protocol so client write by LUA can connect to server?
Thank so much!

Please support BOT api

Hi,
I think it is very hard to grow up user from zero. So in Match-making please support bot to play with user.
With that feature, we can implement simple bot and simple rules (e.x after 10s if we can not match a user with another real user, we will create a bot instance and user can play with).
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.