Constructor
new ServerEngine(io, gameEngine, options) → {ServerEngine}
create a ServerEngine instance
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
io |
SocketIO | the SocketIO server |
||||||||||||||||||||||||||||||||
gameEngine |
GameEngine | instance of GameEngine |
||||||||||||||||||||||||||||||||
options |
Object | server options Properties
|
- Source:
Returns:
serverEngine - self
- Type
- ServerEngine
Members
serializer :GameEngine
reference to game engine
- Source:
Methods
assignObjectToRoom(obj, roomName)
Assign an object to a room
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | the object to move |
roomName |
String | the target room |
- Source:
assignPlayerToRoom(playerId, roomName)
Assign a player to a room
Parameters:
Name | Type | Description |
---|---|---|
playerId |
Number | the playerId |
roomName |
String | the target room |
- Source:
createRoom(roomName)
Create a room
There is a default room called "/lobby". All newly created players and objects are assigned to the default room. When the server sends periodic syncs to the players, each player is only sent those objects which are present in his room.
Parameters:
Name | Type | Description |
---|---|---|
roomName |
String | the new room name |
- Source:
gameStatus() → {String}
Report game status This method is only relevant if the game uses MatchMaker functionality. This method must return the game status.
- Source:
Returns:
Stringified game status object.
- Type
- String