mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-30 16:40:46 +08:00
Update README.md
This commit is contained in:
@@ -21,6 +21,42 @@ A simple, lightweight, HTML multiplayer game server (and client) for Node.js
|
||||
|
||||
### Client
|
||||
|
||||
```js
|
||||
GarageServerIO.initializeGarageServer(path, options)
|
||||
|
||||
options = {
|
||||
onPlayerConnect(callback),
|
||||
onPlayerDisconnect(callback),
|
||||
onPlayerReconnect(callback),
|
||||
onPlayerUpdate(callback(state)),
|
||||
onEntityUpdate(callback(state)),
|
||||
onPlayerRemove(callback(id)),
|
||||
onEntityRemove(callback(id)),
|
||||
onEvent(callback(data)),
|
||||
onWorldState(callback(state)),
|
||||
onPing(callback(pingDelay)),
|
||||
onUpdatePlayerPhysics(callback(state, inputs, deltaTime)),
|
||||
onInterpolation(callback(previousState, targetState, amount)),
|
||||
onReady(callback,
|
||||
logging: true
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
GarageServerIO.addInput(input)
|
||||
```
|
||||
|
||||
```js
|
||||
GarageServerIO.getStates(callback(playerStates: [player1State, player2State, ...], entityStates: [entity1State, entity2State, ...]))
|
||||
```
|
||||
|
||||
```js
|
||||
GarageServerIO.getId() : 'playerid'
|
||||
```
|
||||
|
||||
```js
|
||||
GarageServerIO.sendServerEvent(data)
|
||||
```
|
||||
|
||||
### Server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user