Game
The top-level files describe the whole of Pong rather than any one
player, instance or entity. Pong has a single top-level file, its config;
everything the game does lives in the four folders below. When the game is synced the server also
writes two generated bundles beside these, gamehoster.server.js and
gamehoster.client.js, built from the files in those folders.
<gamehoster-config-contentRoot>/
game.gamehoster.org/
gamehoster-games/
pong/
gamehoster-game.json
gamehoster-player/
gamehoster-instance/
gamehoster-commands/
gamehoster-entities/
Contents
The game folder holds one config file and four folders, one for each kind of thing in the game.
| Name | Type | Description |
|---|---|---|
gamehoster-game.json | file | The whole game config. |
gamehoster-player/ | directory | The player: join and state schemas and the lifecycle scripts. |
gamehoster-instance/ | directory | The instance: state schema and the authoritative update. |
gamehoster-commands/ | directory | The moveY and ready commands. |
gamehoster-entities/ | directory | The ball. |
gamehoster-game.json
The whole config: the title, that players are dropped straight in and paired automatically with no browse or create, the 60 per second simulation rate and 20 per second send rate, fast enough to keep the ball smooth, and a capacity of 2, so each instance is exactly one match.
{
"gamehoster-game-title": "Pong",
"gamehoster-game-browse": "none",
"gamehoster-game-create": "none",
"gamehoster-game-tickRate": 60,
"gamehoster-game-sendRate": 20,
"gamehoster-game-capacity": 2
}