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/
The pong game folder: its config and the four component folders.

Contents

The game folder holds one config file and four folders, one for each kind of thing in the game.

NameTypeDescription
gamehoster-game.jsonfileThe whole game config.
gamehoster-player/directoryThe player: join and state schemas and the lifecycle scripts.
gamehoster-instance/directoryThe instance: state schema and the authoritative update.
gamehoster-commands/directoryThe moveY and ready commands.
gamehoster-entities/directoryThe 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
}
pong/gamehoster-game.json