Resolved: #12 Regions - limit state bandwidth

This commit is contained in:
Jeremiah Billmann
2013-08-23 13:30:13 -04:00
parent e805c2d991
commit 790c69305a
8 changed files with 132 additions and 30 deletions
+27 -1
View File
@@ -236,4 +236,30 @@ GarageServerIO.sendPlayersEvent(data)
```
Allows server to broadcast events to all players. Use this to make custom calls to GarageServer.IO clients for your game.
`data` **object literal**
Object containing all properties specific to the custom event.
Object containing all properties specific to the custom event.
#### setPlayerRegion
---
```js
GarageServerIO.setPlayerRegion(id, region)
```
Sets the player region. GarageServer.IO will broadcast the state of players and entities who share the same region. NOTE: This will implicitly enable GarageServer.IO region broadcasting - only those players and entities with regions with be notified of state. Use `clearRegions` to revert region broadcasting.
`id` **string**
Id of the player to receive event.
`region` **string**
Name of the region.
#### setEntityRegion
---
```js
GarageServerIO.setEntityRegion(id, region)
```
Sets the entity region. GarageServer.IO will broadcast the state of players and entities who share the same region. NOTE: This will implicitly enable GarageServer.IO region broadcasting - only those players and entities with regions with be notified of state. Use `clearRegions` to revert region broadcasting.
`id` **string**
Id of the entity to receive event.
`region` **string**
Name of the region.
#### clearRegions
---
```js
GarageServerIO.clearRegions()
```
Clears all regions associated with players and entities. GarageServer.IO will default back to broadcasting state to all players.