# Checklist for adding a game

1. Add a `unihub.manifest.json` to the game's folder ([game manifest](manifest.md)). For an
   existing game, keep the id from the [game id table](achievements.md#game-id), and credit the
   people who made it by Hub nickname in `developers`.
2. Install the SDK, `npm install @unikia/upe-sdk` ([on npm](https://www.npmjs.com/package/@unikia/upe-sdk)), and create one `Uniplay` for the
   game id at startup: `new Uniplay({ game: '<game id>' })`. A game may also port the SDK or
   write its own, as long as it follows these pages.
3. For achievements, write `public/achievements.json`, name it as `achievements` in
   the manifest, then call `unlock(id)` / `setProgress(id, value)` / `addProgress(id, delta)`
   where the moments happen ([achievements](achievements.md)). Award them from what the local
   player saw happen. In co-op, each player earns them in their own browser.
4. For saves, use `saves.write(slot, data, { label, summary, playtime })`,
   `saves.read(slot)` and `saves.remove(slot)`. Move any old save keys with
   `saves.adopt(oldKey, slot)` on start ([saves](saves.md)).
5. Inside the Hub: add an "Exit" item to the title menu when
   `uniplay.shell.canExit`, save in `uniplay.shell.onExit`, and ignore input while
   `uniplay.shell.paused`. Leave `Backquote`, Home, and Back + Start alone
   ([the Hub shell](hub.md#the-hub-shell)).
6. For online co-op, use `uniplay.net` ([Buds rooms](hub.md#buds-rooms)): `home()` to host in
   the player's own room, `join(code)` to join a friend's, `onJoin` / `onLeave` for players of
   this game, and `channel(name)` to send. Call `startHosting()` when the player hosts (and
   `stopHosting()` when they stop), and handle `onInvite(code)` by joining that room. Pass
   Trystero's `joinRoom` as `net.joinRoom` so co-op still works outside the Hub.
7. Time played needs nothing: creating the `Uniplay` instance at startup counts it
   ([time played](playtime.md)).
8. Build the game with relative URLs, so it works from any `/<path>/`, and run
   `npx -p @unikia/upe-cli uniplay validate`: it checks the manifest, the built entry, the covers (16:9, 1:1) and
   the achievements.
9. Run `npx -p @unikia/upe-cli uniplay pack` and check the zip against the
   [package rules](manifest.md#the-game-package).
10. Ask for a Publisher profile from the Hub's Feedback window, then upload the zip from your
    publisher dashboard at `/publisher/`, or make a key there and submit with
    `npx -p @unikia/upe-cli uniplay submit --key uk_sub_…`
    ([submitting](submitting.md)). The first version goes live once an admin has reviewed it.
