diff --git a/client/garageserver.io.js b/client/garageserver.io.js index 4db2177..d2a0dbd 100644 --- a/client/garageserver.io.js +++ b/client/garageserver.io.js @@ -21,6 +21,9 @@ api methods getPlayerStates : [, playerState] getEntityStates : [, entityState] updatePlayerState(id, state) + addEntity(id, state) + updateEntityState(id, state) + removeEntity(id) getId() : playerid sendServerEvent(data) */ @@ -354,6 +357,14 @@ var GarageServerIO = (function (socketio) { _playerController.remove(id); }, + addEntity = function (id, state) { + + }, + + updateEntityState = function (id, state) { + + }, + removeEntity = function (id) { _entityController.remove(id); }, @@ -439,6 +450,9 @@ var GarageServerIO = (function (socketio) { getPlayerStates: getPlayerStates, getEntityStates: getEntityStates, updatePlayerState: updatePlayerState, + addEntity: addEntity, + updateEntityState: updateEntityState, + removeEntity: removeEntity, getId: getId, sendServerEvent: sendServerEvent }; diff --git a/documentation/ClientAPI.md b/documentation/ClientAPI.md index 9111199..25e1120 100644 --- a/documentation/ClientAPI.md +++ b/documentation/ClientAPI.md @@ -201,6 +201,53 @@ Returns a list of current entity states from the most recent broadcast depending The id of the entity. `state` **object literal** Object containing all properties specific to entity state in your game. + +#### updatePlayerState +--- +```js +GarageServerIO.updatePlayerState(id, state) +``` +Notify the GarageServer.IO client of the new player state - this is intended to be used with client side prediction. + +`id` **string** +The id of the player. +`state` **object literal** +Object containing all properties specific to the new player state in your game. + +#### addEntity +--- +```js +GarageServerIO.addEntity(id, state) +``` +Notify the GarageServer.IO client of a new entity with an initial state - this is intended to be used with client side prediction. + +`id` **string** +The id of the entity. +`state` **object literal** +Object containing all properties specific to new entity state in your game. + +#### updateEntityState +--- +```js +GarageServerIO.updateEntityState(id, state) +``` +Notify the GarageServer.IO client of the new entity state - this is intended to be used with client side prediction. + +`id` **string** +The id of the entity. +`state` **object literal** +Object containing all properties specific to the new entity state in your game. + +#### removeEntity +--- +```js +GarageServerIO.removeEntity(id) +``` +Notify the GarageServer.IO client that an entity has been removed from the game - this is intended to be used with client side prediction. + +`id` **string** +The id of the entity. + #### getId --- ```js diff --git a/documentation/ServerAPI.md b/documentation/ServerAPI.md index 987376e..578f8ab 100644 --- a/documentation/ServerAPI.md +++ b/documentation/ServerAPI.md @@ -181,7 +181,7 @@ List of all previous states and their execution times up to `options.maxHistoryS GarageServerIO.updatePlayerState(id, state) ``` -Notify GargeServer.IO of a new state with an id of the player to be updated. The idea here is that this call is made during each pass of the physics loop on the server. +Notify GarageServer.IO of a new state with an id of the player to be updated. The idea here is that this call is made during each pass of the physics loop on the server. `id` **string** Id of the player whose state should be updated. @@ -193,7 +193,7 @@ New state of the entity containing all of the properties specific to a player fo GarageServerIO.updateEntityState(id, state) ``` -Notify GargeServer.IO of a new state with an id of the entity to be updated. The idea here is that this call is made during each pass of the physics loop on the server. +Notify GarageServer.IO of a new state with an id of the entity to be updated. The idea here is that this call is made during each pass of the physics loop on the server. `id` **string** Id of the entity whose state should be updated.