Game

The top-level files describe the whole of Snake rather than any one player, instance or entity. Snake 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/
      snake/
        gamehoster-game.json
        gamehoster-player/
        gamehoster-instance/
        gamehoster-commands/
        gamehoster-entities/
The snake 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 steer command.
gamehoster-entities/directoryThe tail and food.

gamehoster-game.json

The whole config: the title, that players are dropped straight in with no browse or create, so there is no lobby and the join script places each player into an instance, the 4 per second simulation rate and 4 per second send rate, one send per whole-cell step, and a capacity of 50, so up to fifty snakes share one instance.

{
  "gamehoster-game-title": "Snake",
  "gamehoster-game-browse": "none",
  "gamehoster-game-create": "none",
  "gamehoster-game-tickRate": 4,
  "gamehoster-game-sendRate": 4,
  "gamehoster-game-capacity": 50
}
snake/gamehoster-game.json