Easy to use Multiplayer Game Server based on Node.JS. Suitable with HTML5 Websocket, Unity3D (Web/PC, Android, iOS,...), Flash, C++/OpenGL/DirectX, XNA clients,...
Switch branches/tags
Nothing to show
Clone or download

README.md

Node.JS Game Server

This project aim to create an easy to use multiplayer game server. Suitable with HTML5 Websocket, Unity3D, Flash, C++/OpenGL/DirectX, XNA clients,... Programmers onlyhave to implement gameplay logic which will be run in each game room and don't have to care much about the core server. The Core Server is a room-based multiplayer system that enable players connect, chat in Global Lobby, join/create room, chat in rooms.

Usage

You only have to run the server.js to run game server. And write game logic code in room.js

Writing Game Logic

Room Logic will be implemented in run() method of the file: room.js like this:

function run(room, player, msg)
{
	// Implement your game room (server side) logic here
	console.log("Processing " + player.name + "@" + room.name + ": " + msg);
}

With room: is the current game room. player: is the current player who sending message. msg: is the message sent from player.

Core Server Messages

The list below is the messages defined and used by Core Server. You need this to implement some feature (join room, create room, chat,...) in client-side

  1. Player connected to server

    RECEIVE: [CONNECTED;] (Everyone except sender)

  2. Player disconnected from server

    RECEIVE: [DISCONNECTED;] (Everyone except sender)

  3. Player send a chat message in Global chat

    SEND: [CHAT;] RECEIVE: [CHAT;;] (Everyone in Global lobby)

  4. Player created a Room

    SEND: [CREATEROOM;;]

  5. Player joined room

    SEND: [JOINROOM;] RECEIVE: [JOINEDROOM;] (Sender) [JOINROOM;] (Players already in room) [NOROOM;] (Sender - when room not found) [ROOMFULL;] (Sender - when room is full)

  6. Player left room

    SEND: [LEAVEROOM] RECEIVE: [LEFTROOM;] (Players already in room)

  7. Player chat in a room

    SEND: [CHATROOM;] RECEIVE: [CHATROOM;;] (Players already in room)

  8. Get available room list

    SEND: [GETROOMLIST] RECEIVE: [ROOMLIST;] (Sender)