mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-27 16:10:34 +08:00
Creating new GarageServer.IO client API calls to support client side prediction for entities - #20
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user