Home

EdgeMultiplay Server

EdgeMultiplay is a light game server sample that works with EdgeMultiplay Unity Client This server is built using NodeJS

EdgeMultiplay uses a websocket server to communicate GameFlowEvents & GamePlayEvents with the players(connections) and a UDP server to forward GamePlayEvents between players (such as positions and/or rotations).

The server have two main functions:

  • MatchMaking
  • Relay Server

MatchMaking

The server is considered to be a Lobby, the lobby have rooms, players(connections) are assigned to rooms based on room vacancy only.

A Lobby is where all the rooms and the players' connections are stored, Think of a Lobby as the place where all the players hangout before they are matched to a room.

A Room is where the players are grouped together once the game starts players in the room can start forwarding messages between each other.

Relay Server

A relay server does a single job which is forwarding a message from a player to other players in the same room (broadcasting). A player can broadcast a message through websockets (if it's essential message, ex: score), or broadcast a message through udp (if it's not very important message, ex: position of a moving object).

GameFlowEvents

There is 9 standard events on the server that represent the Game State before the GamePlay , see full list of GameFlowEvents in the Event class.

GameStartEvent : A game start event is sent once the number of room members reaches the maximum players per room.

RoomJoinEvent : Room Join Event is sent from the server to the player once a JoinRoom request succeed.

RoomCreatedEvent : Room Created Event is sent from the server to the player once a CreateRoom request succeed.

RoomMemberLeftEvent : RoomMemberLeftEvent is sent from the server to the room members once a room member leaves the room.

AvailableRoomsListEvent : An event that contains the list of available rooms on the lobby, This is the response of EdgeManager.GetAvailableRooms().

NotificationEvent : a Notification Event sent from the server, there are some standard notifications (create-room-faliure, join-room-faliure, new-room-created-in-lobby).

RegisterEvent : a Register Event sent from the server, Register Event is when the player establish its connection with the server and the player is assigned a player id and session id.

PlayerJoinedRoomEvent : A Player Joined Room Event from the server, PlayerJoinedRoom Event is sent by the server to room members once a new player join their room.

RoomsListEvent : An Event containing the list of rooms on the lobby, This is the response of EdgeManager.GetRooms().

GamePlayEvent

There is a single GamePlayEvent, that is a wrapper for data to be trasnferred between players.