@hopple/sdk 0.1.0-rc.3 → 1.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/manifest.md CHANGED
@@ -15,37 +15,41 @@ and the host never asks the game what it is allowed to do.
15
15
 
16
16
  ```json
17
17
  {
18
- "schema": 1,
18
+ "api": "1.0",
19
19
  "id": "ping",
20
20
  "version": "1.0.0",
21
21
  "title": "Ping",
22
22
  "orientation": "portrait",
23
- "sdk": "^0.1.0",
24
23
  "audio": null
25
24
  }
26
25
  ```
27
26
 
28
- These seven keys are required. Everything else is optional.
27
+ These six keys are required. Everything else is optional. A hopple config may
28
+ leave `api` and `previews` out: the CLI fills `api` from the installed
29
+ `@hopple/sdk`, and `previews` from the preview packages the project installs.
29
30
 
30
31
  | Key | Rules | Meaning |
31
32
  |---|---|---|
32
- | `schema` | `1` | The manifest format version. |
33
+ | `api` | `MAJOR.MINOR`, or `next` | The API the game is written against: the major picks what the game is served, the minor is the least it needs. `next` is the pre-releases of the next stable release. Left out of a config, the CLI takes it from the installed `@hopple/sdk` (`1.6.2` is `1.6`, a pre-release is `next`), and refuses one that differs. Publishing is refused until the major has a release of that minor, on `next` until it has a release, and on `next` for users who are neither trusted, admins, nor explicitly granted access. |
33
34
  | `id` | lowercase letters, digits and single hyphens; at most 64 characters | The game's name. On the server, a game is `<owner>/<id>`. |
34
35
  | `version` | `MAJOR.MINOR.PATCH`, optional `-prerelease` | The game's own version. Shown to the game as `sdk.info.game.version`. |
35
36
  | `title` | at most 60 characters | What players see. |
36
37
  | `description` | optional; at most 500 characters | A sentence or two shown beside the title. |
38
+ | `genres` | optional; see [`genres`](#genres) | What kind of game it is, the main one first. |
37
39
  | `orientation` | `portrait`, `landscape` or `any` | The shape the game is designed for. Hosts lay the game out to match. |
38
- | `sdk` | a version, optionally with `^` or `~` | The SDK the game was built against. Recorded, not enforced; the protocol handshake is what checks compatibility. |
39
40
  | `audio` | `null`, or an object | Whether the game makes sound, and its volume channels. See [`audio`](#audio). |
40
41
 
41
42
  ## Validating
42
43
 
43
- `hopple check` validates the manifest and names every problem with its field.
44
- The CLI, the dev shell, the server and the clients all use the same function,
45
- so they always agree on whether a manifest is valid.
44
+ `hopple check` validates the manifest and names every problem with its field,
45
+ with the validator of the installed `@hopple/sdk`, which is of the API the
46
+ game declares. The CLI, the dev shell, the server and the clients all use the
47
+ same function, so they agree on whether a manifest is valid.
46
48
 
47
- - **Unknown keys are allowed.** A game built with a newer SDK may declare
48
- things an older host doesn't know about, and must still run there.
49
+ - **Unknown keys are refused.** A misspelt key (such as `"orientaton"`) is an
50
+ error, not silently ignored. A host reading a published manifest ignores
51
+ keys it doesn't know (`validateManifest(value, { lenient: true })`), since
52
+ the game may be written against a newer minor than the host.
49
53
  - **Known keys are checked strictly.** A misspelt value (such as
50
54
  `"draw_under"`) is an error, not silently ignored.
51
55
 
@@ -216,7 +220,8 @@ up to 8 characters, 8 tiers.
216
220
  `buttons` (naming actions) arranged as a `row`, `column`, `diamond` or
217
221
  `cluster`. An unknown shape is drawn as a column. A stick held to an axis is
218
222
  drawn as a track and always reads 0 on the other axis; a real pad's stick
219
- still reports both.
223
+ still reports both. Any control may have a `scale` from 0.75 to 1.5, its
224
+ size next to the layout's others (1 when left out).
220
225
 
221
226
  Binding names:
222
227
 
@@ -242,6 +247,36 @@ the host's sheet; a tap of Start is still the game's.
242
247
 
243
248
  Limits: 64 actions, 8 bindings per action, 8 control layouts.
244
249
 
250
+ #### Several players on one device
251
+
252
+ ```json
253
+ "players": { "local": 4, "online": 8 },
254
+ "input": {
255
+ "actions": { "pause": { "bind": ["key.KeyP", "pad.start"] } },
256
+ "player": {
257
+ "actions": {
258
+ "bomb": { "bind": ["pad.south"], "title": "Drop bomb", "join": true }
259
+ },
260
+ "keyboard": [
261
+ { "title": "Left keys", "bind": { "bomb": ["key.Space"] } },
262
+ { "title": "Arrows", "bind": { "bomb": ["key.Enter"] } }
263
+ ]
264
+ }
265
+ }
266
+ ```
267
+
268
+ - **`input.player.actions`**: what each local player does, a copy each. Their
269
+ `bind` holds pad buttons and on-screen controls only, the same for every
270
+ pad. An id is never one `input.actions` declares too. `join: true` marks the
271
+ actions that seat a new player; on none, any does.
272
+ - **`input.player.keyboard`**: the parts of the keyboard players share, one
273
+ player each (at most 4): a `title` and the keys and mouse buttons of each
274
+ player action. A key in two parts is refused.
275
+ - **`players.local`**: the most players on one device, 1 by default; more
276
+ than 1 needs `input.player`.
277
+
278
+ Limits: 32 player actions.
279
+
245
280
  ### audio
246
281
 
247
282
  ```json
@@ -262,6 +297,61 @@ Each channel gets its own labelled volume slider in the host's sound controls.
262
297
  `title` is required: it is the slider's label. `master` is reserved, since
263
298
  every host already has a master volume. At most 8 channels.
264
299
 
300
+ ### genres
301
+
302
+ ```json
303
+ "genres": ["puzzle", "shooter", "online-multiplayer"]
304
+ ```
305
+
306
+ What kind of game this is, the main one first: at least one, and at most 3
307
+ beside the two multiplayer words, none twice. A game with none declared is
308
+ filed by what its title and description say, and most often less well.
309
+
310
+ The words are `racing`, `shooter`, `platformer`, `puzzle`, `arcade`, `physics`,
311
+ `roguelike`, `strategy`, `building`, `idle`, `sports`, `horror`, `stealth`,
312
+ `fighting`, `casual`, `simulation`, `adventure`, `rhythm` and `rpg`, and two
313
+ that say how it is played together:
314
+
315
+ - **`local-multiplayer`**: several people on one device. Needs `players.local`
316
+ above 1.
317
+ - **`online-multiplayer`**: over the network. Needs `previews.network`.
318
+
319
+ Either of those without what it needs is not refused: the game is published,
320
+ that word is ignored, and `hopple check`, `hopple upload` and `hopple publish`
321
+ warn about it. They warn the other way round too, for a game that declares
322
+ `genres` and leaves out a way of playing together its manifest shows, since it
323
+ then is not listed as one. Clients group the two under one shelf.
324
+
325
+ ### previews
326
+
327
+ ```json
328
+ "previews": { "network": 1 }
329
+ ```
330
+
331
+ The parts of the SDK that are not stable yet, each at the revision the game
332
+ is written against. A preview is its own `0.x` package, versioned apart from
333
+ `api`: revision `R` is `@hopple/sdk-preview-network` `0.R.x`. A game is served a runtime
334
+ with the previews it declares, at those revisions, so a change to a preview
335
+ reaches only the games written against it. A breaking change is a new
336
+ revision. A name nobody knows is refused, and a revision is a whole number
337
+ from 1.
338
+
339
+ Left out of a config, the CLI fills each preview from its installed package,
340
+ for a project whose `package.json` lists it, as it fills `api`, and refuses
341
+ one that differs from the installed revision, or that names one with none
342
+ installed. Publishing a game that declares any preview needs what `next`
343
+ needs. Once a newer revision of a preview is out, the older one is retired:
344
+ games whose `latest` is on it are unlisted and lose `beta`, keeping their
345
+ approval and links, and an upload declaring it is refused.
346
+
347
+ - **`network`**: the game plays over the network, in matches: `sdk.match`,
348
+ typed by `@hopple/sdk-preview-network`. It is the permission a reviewer grants, and what
349
+ lets a host offer *Play with friends* before the game has loaded. Nothing
350
+ else is declared: how a match is played, and its size, are chosen when the
351
+ game makes one.
352
+ Without it, a game is never told about a match, and `sdk.match` is not
353
+ there.
354
+
265
355
  ## Changing the manifest in a new version
266
356
 
267
357
  The server refuses a new version whose manifest would corrupt data players
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@hopple/sdk",
3
- "version": "0.1.0-rc.3",
3
+ "version": "1.0.0-next.4",
4
4
  "description": "The Hopple SDK: what a game imports to talk to the host that runs it, forwarded to the runtime its page loads.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://hopple.app",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/pamarit/hopple.git"
10
+ },
7
11
  "keywords": [
8
12
  "hopple",
9
13
  "game",
@@ -21,6 +25,10 @@
21
25
  "types": "./index.d.ts",
22
26
  "default": "./index.js"
23
27
  },
28
+ "./manifest": {
29
+ "types": "./manifest.d.ts",
30
+ "default": "./manifest.js"
31
+ },
24
32
  "./config.schema.json": "./config.schema.json",
25
33
  "./package.json": "./package.json"
26
34
  },