@indiegems/gem-web-sdk 10.2.0 → 10.3.1
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/CHANGELOG.md +22 -0
- package/dist/game.d.ts +49 -1
- package/dist/gem-web-sdk.bridge.js +1 -1
- package/dist/gem-web-sdk.esm.js +2 -2
- package/dist/gem-web-sdk.function.js +2 -2
- package/dist/gem-web-sdk.game.js +2 -2
- package/dist/gem-web-sdk.min.js +2 -2
- package/dist/gem-web-sdk.sdk.js +2 -2
- package/dist/gem-web-sdk.server.js +2 -2
- package/dist/index.d.ts +32 -3
- package/dist/sdk.d.ts +49 -1
- package/docs/api/api-reference-game.md +546 -36
- package/docs/api/api-reference-server.md +1 -1
- package/docs/api/reference.json +683 -10
- package/docs/brand-art.md +6 -4
- package/docs/changelog.md +22 -0
- package/docs/daily-challenges.md +4 -4
- package/docs/getting-started.md +1 -1
- package/docs/inventory-and-catalogs.md +11 -7
- package/docs/manifest.json +14 -14
- package/docs/server-bundles.md +2 -2
- package/docs/what-a-game-must-do.md +168 -90
- package/package.json +1 -1
- package/schema/bridge.v1.json +142 -14
- package/schema/capabilities.public.json +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The browser surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v10.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v10.3.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/game` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -4590,6 +4590,417 @@ only when your studio corrects a running period; clients may hold the old
|
|
|
4590
4590
|
content for up to an hour afterwards, and the hash is how a verifier tells
|
|
4591
4591
|
them apart.
|
|
4592
4592
|
|
|
4593
|
+
<a id="gemlookspeed"></a>
|
|
4594
|
+
|
|
4595
|
+
## GemLookSpeed
|
|
4596
|
+
|
|
4597
|
+
```ts
|
|
4598
|
+
interface GemLookSpeed
|
|
4599
|
+
```
|
|
4600
|
+
|
|
4601
|
+
A look speed per axis, in radians: per CSS px for a pointer, per second at
|
|
4602
|
+
full tilt for a stick.
|
|
4603
|
+
|
|
4604
|
+
<a id="gemlookspeed-yaw"></a>
|
|
4605
|
+
|
|
4606
|
+
## GemLookSpeed.yaw
|
|
4607
|
+
|
|
4608
|
+
```ts
|
|
4609
|
+
readonly yaw: number
|
|
4610
|
+
```
|
|
4611
|
+
|
|
4612
|
+
Across: radians of yaw.
|
|
4613
|
+
|
|
4614
|
+
<a id="gemlookspeed-pitch"></a>
|
|
4615
|
+
|
|
4616
|
+
## GemLookSpeed.pitch
|
|
4617
|
+
|
|
4618
|
+
```ts
|
|
4619
|
+
readonly pitch: number
|
|
4620
|
+
```
|
|
4621
|
+
|
|
4622
|
+
Up/down: radians of pitch.
|
|
4623
|
+
|
|
4624
|
+
<a id="gemlookbase"></a>
|
|
4625
|
+
|
|
4626
|
+
## GemLookBase
|
|
4627
|
+
|
|
4628
|
+
```ts
|
|
4629
|
+
interface GemLookBase
|
|
4630
|
+
```
|
|
4631
|
+
|
|
4632
|
+
The shape of `gem.controls.LOOK_BASE`: Roblox's base look speeds and the
|
|
4633
|
+
stick and touch shaping constants `gem.controls.look()` applies.
|
|
4634
|
+
|
|
4635
|
+
<a id="gemlookbase-touch"></a>
|
|
4636
|
+
|
|
4637
|
+
## GemLookBase.touch
|
|
4638
|
+
|
|
4639
|
+
```ts
|
|
4640
|
+
readonly touch: GemLookSpeed
|
|
4641
|
+
```
|
|
4642
|
+
|
|
4643
|
+
Radians per CSS px, for touch and pen: 1° across, 0.66° up/down.
|
|
4644
|
+
|
|
4645
|
+
<a id="gemlookbase-mouse"></a>
|
|
4646
|
+
|
|
4647
|
+
## GemLookBase.mouse
|
|
4648
|
+
|
|
4649
|
+
```ts
|
|
4650
|
+
readonly mouse: GemLookSpeed
|
|
4651
|
+
```
|
|
4652
|
+
|
|
4653
|
+
Radians per CSS px, for a mouse: 0.5° across, 0.385° up/down.
|
|
4654
|
+
|
|
4655
|
+
<a id="gemlookbase-stick"></a>
|
|
4656
|
+
|
|
4657
|
+
## GemLookBase.stick
|
|
4658
|
+
|
|
4659
|
+
```ts
|
|
4660
|
+
readonly stick: GemLookSpeed
|
|
4661
|
+
```
|
|
4662
|
+
|
|
4663
|
+
Radians per second at full tilt, for a gamepad stick: 240° across, 184.8° up/down.
|
|
4664
|
+
|
|
4665
|
+
<a id="gemlookbase-stickdeadzone"></a>
|
|
4666
|
+
|
|
4667
|
+
## GemLookBase.stickDeadzone
|
|
4668
|
+
|
|
4669
|
+
```ts
|
|
4670
|
+
readonly stickDeadzone: number
|
|
4671
|
+
```
|
|
4672
|
+
|
|
4673
|
+
A stick axis below this magnitude turns nothing: 0.1.
|
|
4674
|
+
|
|
4675
|
+
<a id="gemlookbase-stickcurve"></a>
|
|
4676
|
+
|
|
4677
|
+
## GemLookBase.stickCurve
|
|
4678
|
+
|
|
4679
|
+
```ts
|
|
4680
|
+
readonly stickCurve: number
|
|
4681
|
+
```
|
|
4682
|
+
|
|
4683
|
+
The stick curve's curvature `k` in `(e^(k·d) − 1) / (e^k − 1)`: 2.
|
|
4684
|
+
|
|
4685
|
+
<a id="gemlookbase-touchpitchmin"></a>
|
|
4686
|
+
|
|
4687
|
+
## GemLookBase.touchPitchMin
|
|
4688
|
+
|
|
4689
|
+
```ts
|
|
4690
|
+
readonly touchPitchMin: number
|
|
4691
|
+
```
|
|
4692
|
+
|
|
4693
|
+
The least fraction of the pitch speed a touch drag keeps straight up or down: 0.25.
|
|
4694
|
+
|
|
4695
|
+
<a id="gemlookoptions"></a>
|
|
4696
|
+
|
|
4697
|
+
## GemLookOptions
|
|
4698
|
+
|
|
4699
|
+
```ts
|
|
4700
|
+
interface GemLookOptions
|
|
4701
|
+
```
|
|
4702
|
+
|
|
4703
|
+
The game's own overrides for `gem.controls.look()` — what the player chose in
|
|
4704
|
+
YOUR settings screen. Each one wins over the Arcade's value; leave one out to
|
|
4705
|
+
follow the Arcade.
|
|
4706
|
+
|
|
4707
|
+
<a id="gemlookoptions-sensitivity"></a>
|
|
4708
|
+
|
|
4709
|
+
## GemLookOptions.sensitivity
|
|
4710
|
+
|
|
4711
|
+
```ts
|
|
4712
|
+
readonly sensitivity?: number
|
|
4713
|
+
```
|
|
4714
|
+
|
|
4715
|
+
The player's own look speed for touch, mouse and pen, as a multiplier
|
|
4716
|
+
(`1` = the base speed). Wins over `gem.prefs.recommended.lookSensitivity`.
|
|
4717
|
+
|
|
4718
|
+
<a id="gemlookoptions-gamepadsensitivity"></a>
|
|
4719
|
+
|
|
4720
|
+
## GemLookOptions.gamepadSensitivity
|
|
4721
|
+
|
|
4722
|
+
```ts
|
|
4723
|
+
readonly gamepadSensitivity?: number
|
|
4724
|
+
```
|
|
4725
|
+
|
|
4726
|
+
The player's own look speed for a gamepad stick, as a multiplier. Wins
|
|
4727
|
+
over `gem.prefs.recommended.gamepadLookSensitivity`.
|
|
4728
|
+
|
|
4729
|
+
<a id="gemlookoptions-inverty"></a>
|
|
4730
|
+
|
|
4731
|
+
## GemLookOptions.invertY
|
|
4732
|
+
|
|
4733
|
+
```ts
|
|
4734
|
+
readonly invertY?: boolean
|
|
4735
|
+
```
|
|
4736
|
+
|
|
4737
|
+
The player's own inverted up/down look. Wins over
|
|
4738
|
+
`gem.prefs.recommended.invertLookY`.
|
|
4739
|
+
|
|
4740
|
+
<a id="gemlookdelta"></a>
|
|
4741
|
+
|
|
4742
|
+
## GemLookDelta
|
|
4743
|
+
|
|
4744
|
+
```ts
|
|
4745
|
+
interface GemLookDelta
|
|
4746
|
+
```
|
|
4747
|
+
|
|
4748
|
+
A turn to apply to your camera, in radians to ADD: `yaw` positive turns
|
|
4749
|
+
right (clockwise seen from above), `pitch` positive looks up.
|
|
4750
|
+
|
|
4751
|
+
<a id="gemlookdelta-yaw"></a>
|
|
4752
|
+
|
|
4753
|
+
## GemLookDelta.yaw
|
|
4754
|
+
|
|
4755
|
+
```ts
|
|
4756
|
+
readonly yaw: number
|
|
4757
|
+
```
|
|
4758
|
+
|
|
4759
|
+
Radians to add to the camera's yaw; positive turns right.
|
|
4760
|
+
|
|
4761
|
+
<a id="gemlookdelta-pitch"></a>
|
|
4762
|
+
|
|
4763
|
+
## GemLookDelta.pitch
|
|
4764
|
+
|
|
4765
|
+
```ts
|
|
4766
|
+
readonly pitch: number
|
|
4767
|
+
```
|
|
4768
|
+
|
|
4769
|
+
Radians to add to the camera's pitch; positive looks up.
|
|
4770
|
+
|
|
4771
|
+
<a id="gemlook"></a>
|
|
4772
|
+
|
|
4773
|
+
## GemLook
|
|
4774
|
+
|
|
4775
|
+
```ts
|
|
4776
|
+
interface GemLook
|
|
4777
|
+
```
|
|
4778
|
+
|
|
4779
|
+
The look helper `gem.controls.look()` returns. Pure math: it listens to
|
|
4780
|
+
nothing and moves no camera — feed it the deltas your input code already
|
|
4781
|
+
has and add what it returns to your camera's yaw and pitch, then clamp the
|
|
4782
|
+
pitch as you always do.
|
|
4783
|
+
|
|
4784
|
+
<a id="gemlook-frompointer"></a>
|
|
4785
|
+
|
|
4786
|
+
## GemLook.fromPointer
|
|
4787
|
+
|
|
4788
|
+
```ts
|
|
4789
|
+
fromPointer(dx: number, dy: number, pointerType: string, pitch?: number): GemLookDelta
|
|
4790
|
+
```
|
|
4791
|
+
|
|
4792
|
+
A pointer move — a touch drag, a mouse move (under pointer lock,
|
|
4793
|
+
`movementX` / `movementY`) or a pen — turned into a look turn.
|
|
4794
|
+
|
|
4795
|
+
| Parameter | Type | Description |
|
|
4796
|
+
| --- | --- | --- |
|
|
4797
|
+
| `dx` | `number` | The move across, in CSS px, right positive. |
|
|
4798
|
+
| `dy` | `number` | The move down the screen, in CSS px, DOWN positive (as
|
|
4799
|
+
`PointerEvent` reports it). Dragging up looks up. |
|
|
4800
|
+
| `pointerType` | `string` | The event's `pointerType`: `'touch'` and `'pen'` take
|
|
4801
|
+
the touch speeds, anything else the mouse speeds. |
|
|
4802
|
+
| `pitch` | `number` | The camera's current pitch in radians (0 = the horizon,
|
|
4803
|
+
positive = looking up), for the touch slowdown near straight up or
|
|
4804
|
+
down. Leave it out to skip the slowdown. |
|
|
4805
|
+
|
|
4806
|
+
<a id="gemlook-fromstick"></a>
|
|
4807
|
+
|
|
4808
|
+
## GemLook.fromStick
|
|
4809
|
+
|
|
4810
|
+
```ts
|
|
4811
|
+
fromStick(x: number, y: number, dt: number): GemLookDelta
|
|
4812
|
+
```
|
|
4813
|
+
|
|
4814
|
+
A right stick turned into a look turn over one frame.
|
|
4815
|
+
|
|
4816
|
+
| Parameter | Type | Description |
|
|
4817
|
+
| --- | --- | --- |
|
|
4818
|
+
| `x` | `number` | The stick's horizontal axis as the Gamepad API reports it,
|
|
4819
|
+
−1..1, right positive. |
|
|
4820
|
+
| `y` | `number` | The stick's vertical axis as the Gamepad API reports it, −1..1,
|
|
4821
|
+
DOWN positive. Pushing up looks up. |
|
|
4822
|
+
| `dt` | `number` | The frame's duration in seconds. |
|
|
4823
|
+
|
|
4824
|
+
<a id="gemlook-set"></a>
|
|
4825
|
+
|
|
4826
|
+
## GemLook.set
|
|
4827
|
+
|
|
4828
|
+
```ts
|
|
4829
|
+
set(options: GemLookOptions): void
|
|
4830
|
+
```
|
|
4831
|
+
|
|
4832
|
+
Change your game's overrides — call it when the player changes a setting
|
|
4833
|
+
in your settings screen. Each key you pass replaces that override; a key
|
|
4834
|
+
passed as `undefined` removes it, so that input follows the Arcade again;
|
|
4835
|
+
a key you leave out is unchanged.
|
|
4836
|
+
|
|
4837
|
+
| Parameter | Type |
|
|
4838
|
+
| --- | --- |
|
|
4839
|
+
| `options` | `GemLookOptions` |
|
|
4840
|
+
|
|
4841
|
+
**Throws.** TypeError when a sensitivity is not a finite number above 0, or
|
|
4842
|
+
`invertY` is not a boolean.
|
|
4843
|
+
|
|
4844
|
+
<a id="controlsapi"></a>
|
|
4845
|
+
|
|
4846
|
+
## ControlsApi
|
|
4847
|
+
|
|
4848
|
+
```ts
|
|
4849
|
+
interface ControlsApi
|
|
4850
|
+
```
|
|
4851
|
+
|
|
4852
|
+
`gem.controls` — the player's camera and controls settings: tell the Arcade
|
|
4853
|
+
which ones your game leaves to the player, and turn look input into a camera
|
|
4854
|
+
turn at the player's sensitivity.
|
|
4855
|
+
|
|
4856
|
+
**Guides.** [what-a-game-must-do](../what-a-game-must-do.md)
|
|
4857
|
+
|
|
4858
|
+
<a id="controlsapi-declare"></a>
|
|
4859
|
+
|
|
4860
|
+
## ControlsApi.declare
|
|
4861
|
+
|
|
4862
|
+
```ts
|
|
4863
|
+
declare(uses: GemControlsDeclaration): boolean
|
|
4864
|
+
```
|
|
4865
|
+
|
|
4866
|
+
Tell the Arcade which of the player's camera and controls settings your
|
|
4867
|
+
game uses, and for each one who decides it: `'player'` — you apply the
|
|
4868
|
+
Arcade's value from `gem.prefs.recommended` (or the player's own choice
|
|
4869
|
+
in your settings, which wins) — or `'game'` — you decide it yourself, and
|
|
4870
|
+
the Arcade's Settings shows that row as "Set by this game". Leave out a
|
|
4871
|
+
setting your game does not use.
|
|
4872
|
+
|
|
4873
|
+
```js
|
|
4874
|
+
gem.controls.declare({
|
|
4875
|
+
lookSensitivity: 'player',
|
|
4876
|
+
gamepadLookSensitivity: 'player',
|
|
4877
|
+
invertLookY: 'player',
|
|
4878
|
+
touchMovement: 'game', // this game always uses a fixed stick
|
|
4879
|
+
});
|
|
4880
|
+
```
|
|
4881
|
+
|
|
4882
|
+
**It is screen state, not a toggle.** Each call is the whole answer and
|
|
4883
|
+
replaces the last. The SDK holds it and sends it again after every
|
|
4884
|
+
reconnect, so call it once at boot, and again only when the answer
|
|
4885
|
+
changes. Any other key or value is dropped.
|
|
4886
|
+
|
|
4887
|
+
| Parameter | Type |
|
|
4888
|
+
| --- | --- |
|
|
4889
|
+
| `uses` | `GemControlsDeclaration` |
|
|
4890
|
+
|
|
4891
|
+
**Returns.** `true` when the Arcade was told now; `false` before the bridge is
|
|
4892
|
+
up (the declaration is held and sent when it connects), outside the
|
|
4893
|
+
Arcade, and under an embedder that does not show these settings. Never
|
|
4894
|
+
throws.
|
|
4895
|
+
|
|
4896
|
+
<a id="controlsapi-look"></a>
|
|
4897
|
+
|
|
4898
|
+
## ControlsApi.look
|
|
4899
|
+
|
|
4900
|
+
```ts
|
|
4901
|
+
look(options?: GemLookOptions): GemLook
|
|
4902
|
+
```
|
|
4903
|
+
|
|
4904
|
+
Make a look helper: Roblox's camera-input math at the player's look
|
|
4905
|
+
sensitivity and invert. Make one and keep it.
|
|
4906
|
+
|
|
4907
|
+
```js
|
|
4908
|
+
const look = gem.controls.look();
|
|
4909
|
+
// A mouse under pointer lock; for touch, pass the change in clientX/clientY.
|
|
4910
|
+
canvas.addEventListener('pointermove', (e) => {
|
|
4911
|
+
if (document.pointerLockElement !== canvas) return;
|
|
4912
|
+
const t = look.fromPointer(e.movementX, e.movementY, e.pointerType, camera.pitch);
|
|
4913
|
+
camera.yaw += t.yaw;
|
|
4914
|
+
camera.pitch = clamp(camera.pitch + t.pitch, -1.4, 1.4);
|
|
4915
|
+
});
|
|
4916
|
+
```
|
|
4917
|
+
|
|
4918
|
+
The sensitivity and invert are read **live** on every call: the Arcade's
|
|
4919
|
+
`gem.prefs.recommended` values, unless `options` (or a later
|
|
4920
|
+
[GemLook.set](#gemlook-set)) gives your game's own, which win.
|
|
4921
|
+
|
|
4922
|
+
| Parameter | Type |
|
|
4923
|
+
| --- | --- |
|
|
4924
|
+
| `options` | `GemLookOptions` |
|
|
4925
|
+
|
|
4926
|
+
**Throws.** TypeError when an option is malformed, as [GemLook.set](#gemlook-set).
|
|
4927
|
+
|
|
4928
|
+
<a id="controlsapi-look_base"></a>
|
|
4929
|
+
|
|
4930
|
+
## ControlsApi.LOOK_BASE
|
|
4931
|
+
|
|
4932
|
+
```ts
|
|
4933
|
+
readonly LOOK_BASE: GemLookBase
|
|
4934
|
+
```
|
|
4935
|
+
|
|
4936
|
+
The base speeds `look` applies at 1×, in radians. Frozen.
|
|
4937
|
+
|
|
4938
|
+
<a id="gemcontrolchoice"></a>
|
|
4939
|
+
|
|
4940
|
+
## GemControlChoice
|
|
4941
|
+
|
|
4942
|
+
```ts
|
|
4943
|
+
type GemControlChoice = "player" | "game"
|
|
4944
|
+
```
|
|
4945
|
+
|
|
4946
|
+
Who decides one camera or controls setting: `'player'` — your game applies
|
|
4947
|
+
the Arcade's value, or the player's own in-game choice, which wins — or
|
|
4948
|
+
`'game'` — your game decides it itself, and the Arcade's Settings shows the
|
|
4949
|
+
row as "Set by this game".
|
|
4950
|
+
|
|
4951
|
+
<a id="gemcontrolsdeclaration"></a>
|
|
4952
|
+
|
|
4953
|
+
## GemControlsDeclaration
|
|
4954
|
+
|
|
4955
|
+
```ts
|
|
4956
|
+
interface GemControlsDeclaration
|
|
4957
|
+
```
|
|
4958
|
+
|
|
4959
|
+
What `gem.controls.declare` takes: for each of the player's camera and
|
|
4960
|
+
controls settings your game uses, who decides it. Leave a setting out when
|
|
4961
|
+
your game does not use it at all — the Arcade then says "This game doesn't
|
|
4962
|
+
use this" beside that row.
|
|
4963
|
+
|
|
4964
|
+
<a id="gemcontrolsdeclaration-looksensitivity"></a>
|
|
4965
|
+
|
|
4966
|
+
## GemControlsDeclaration.lookSensitivity
|
|
4967
|
+
|
|
4968
|
+
```ts
|
|
4969
|
+
readonly lookSensitivity?: GemControlChoice
|
|
4970
|
+
```
|
|
4971
|
+
|
|
4972
|
+
Look speed for touch, mouse and pen — `gem.prefs.recommended.lookSensitivity`.
|
|
4973
|
+
|
|
4974
|
+
<a id="gemcontrolsdeclaration-gamepadlooksensitivity"></a>
|
|
4975
|
+
|
|
4976
|
+
## GemControlsDeclaration.gamepadLookSensitivity
|
|
4977
|
+
|
|
4978
|
+
```ts
|
|
4979
|
+
readonly gamepadLookSensitivity?: GemControlChoice
|
|
4980
|
+
```
|
|
4981
|
+
|
|
4982
|
+
Look speed for a gamepad stick — `gem.prefs.recommended.gamepadLookSensitivity`.
|
|
4983
|
+
|
|
4984
|
+
<a id="gemcontrolsdeclaration-invertlooky"></a>
|
|
4985
|
+
|
|
4986
|
+
## GemControlsDeclaration.invertLookY
|
|
4987
|
+
|
|
4988
|
+
```ts
|
|
4989
|
+
readonly invertLookY?: GemControlChoice
|
|
4990
|
+
```
|
|
4991
|
+
|
|
4992
|
+
Inverted up/down look — `gem.prefs.recommended.invertLookY`.
|
|
4993
|
+
|
|
4994
|
+
<a id="gemcontrolsdeclaration-touchmovement"></a>
|
|
4995
|
+
|
|
4996
|
+
## GemControlsDeclaration.touchMovement
|
|
4997
|
+
|
|
4998
|
+
```ts
|
|
4999
|
+
readonly touchMovement?: GemControlChoice
|
|
5000
|
+
```
|
|
5001
|
+
|
|
5002
|
+
The touch movement thumbstick, floating or fixed — `gem.prefs.recommended.touchMovement`.
|
|
5003
|
+
|
|
4593
5004
|
<a id="device_settings_max_bytes"></a>
|
|
4594
5005
|
|
|
4595
5006
|
## DEVICE_SETTINGS_MAX_BYTES
|
|
@@ -4782,7 +5193,8 @@ Whether the panel is on screen right now.
|
|
|
4782
5193
|
interface RewardCue
|
|
4783
5194
|
```
|
|
4784
5195
|
|
|
4785
|
-
A platform-currency reward on its way to the arcade
|
|
5196
|
+
A platform-currency reward on its way to the arcade — in the Gem Arcade, a
|
|
5197
|
+
flight into the Gem button at the top-left of your frame — what
|
|
4786
5198
|
`gem.cueReward` takes.
|
|
4787
5199
|
|
|
4788
5200
|
<a id="rewardcue-currencyslug"></a>
|
|
@@ -4794,8 +5206,8 @@ currencySlug: string
|
|
|
4794
5206
|
```
|
|
4795
5207
|
|
|
4796
5208
|
The platform currency's slug, as `gem.platform.currencies.get()` lists it —
|
|
4797
|
-
`GEMS` or `ARCADE_TICKETS`. It decides
|
|
4798
|
-
the payout
|
|
5209
|
+
`GEMS` or `ARCADE_TICKETS`. It decides what flies — gems or tickets — and
|
|
5210
|
+
which of the player's totals the payout moves.
|
|
4799
5211
|
|
|
4800
5212
|
<a id="rewardcue-expected"></a>
|
|
4801
5213
|
|
|
@@ -4820,8 +5232,8 @@ origin?: { x: number; y: number }
|
|
|
4820
5232
|
Where the flight starts, in CSS px of YOUR viewport: the centre of the
|
|
4821
5233
|
currency's icon (or hero) your screen draws beside the reward — the gem
|
|
4822
5234
|
for Gems, the ticket for Tickets. Measure that element's own box, not a
|
|
4823
|
-
row or panel around it. Leave it out and the
|
|
4824
|
-
|
|
5235
|
+
row or panel around it. Leave it out and the Gem Arcade flies the payout
|
|
5236
|
+
from the middle of your frame once the platform confirms it.
|
|
4825
5237
|
|
|
4826
5238
|
<a id="rewardcue-origin-x"></a>
|
|
4827
5239
|
|
|
@@ -5089,9 +5501,9 @@ while connected, and only to an arcade that mirrors a game's mute.
|
|
|
5089
5501
|
cueReward(cue: RewardCue): boolean
|
|
5090
5502
|
```
|
|
5091
5503
|
|
|
5092
|
-
Tell the arcade a platform-currency reward is on its way, so
|
|
5093
|
-
|
|
5094
|
-
|
|
5504
|
+
Tell the arcade a platform-currency reward is on its way, so it can show it
|
|
5505
|
+
landing — in the Gem Arcade, the currency flying from `origin` into the Gem
|
|
5506
|
+
button, the total moving once the platform confirms the grant.
|
|
5095
5507
|
|
|
5096
5508
|
Prefer `gem.cueReward`, which says what the arcade does with it. This one
|
|
5097
5509
|
sends only while connected, and only to an arcade that draws a wallet.
|
|
@@ -5149,6 +5561,30 @@ wallet.
|
|
|
5149
5561
|
**Returns.** whether the message left the frame — `false` before the bridge is
|
|
5150
5562
|
up, for an arcade with no wallet, and past this frame's own limit.
|
|
5151
5563
|
|
|
5564
|
+
<a id="gemframe-declarecontrols"></a>
|
|
5565
|
+
|
|
5566
|
+
## GemFrame.declareControls
|
|
5567
|
+
|
|
5568
|
+
```ts
|
|
5569
|
+
declareControls(uses: GemControlsDeclaration): boolean
|
|
5570
|
+
```
|
|
5571
|
+
|
|
5572
|
+
Tell the arcade which of the player's camera and controls settings your
|
|
5573
|
+
game leaves to the player and which it decides itself — the whole answer
|
|
5574
|
+
each time, the latest one winning.
|
|
5575
|
+
|
|
5576
|
+
Prefer `gem.controls.declare`, which holds the declaration across a
|
|
5577
|
+
reconnect. This one sends only while connected, and only to an arcade
|
|
5578
|
+
that shows these settings.
|
|
5579
|
+
|
|
5580
|
+
| Parameter | Type |
|
|
5581
|
+
| --- | --- |
|
|
5582
|
+
| `uses` | `GemControlsDeclaration` |
|
|
5583
|
+
|
|
5584
|
+
**Returns.** whether the message left the frame — `false` before the bridge is
|
|
5585
|
+
up, for an arcade that does not show these settings, and past this
|
|
5586
|
+
frame's own limit.
|
|
5587
|
+
|
|
5152
5588
|
<a id="gemframe-setmenu"></a>
|
|
5153
5589
|
|
|
5154
5590
|
## GemFrame.setMenu
|
|
@@ -7268,8 +7704,9 @@ readonly recommended: GemRecommendedSettings | null
|
|
|
7268
7704
|
```
|
|
7269
7705
|
|
|
7270
7706
|
The player's Arcade-wide defaults for this device — a volume, battery
|
|
7271
|
-
saver, a keyboard layout, the gamepad's confirm button
|
|
7272
|
-
|
|
7707
|
+
saver, a keyboard layout, the gamepad's confirm button, vibration, and the
|
|
7708
|
+
camera and controls settings (look sensitivity, gamepad look sensitivity,
|
|
7709
|
+
invert look, touch movement) — or `null` when the Arcade did not send them.
|
|
7273
7710
|
|
|
7274
7711
|
**Recommendations only; the player's own choice in your game wins.** Start
|
|
7275
7712
|
a setting from here while the player has made no choice of their own for
|
|
@@ -7353,6 +7790,54 @@ readonly vibration: boolean
|
|
|
7353
7790
|
|
|
7354
7791
|
Whether the player wants vibration and controller rumble.
|
|
7355
7792
|
|
|
7793
|
+
<a id="gemrecommendedsettings-looksensitivity"></a>
|
|
7794
|
+
|
|
7795
|
+
## GemRecommendedSettings.lookSensitivity
|
|
7796
|
+
|
|
7797
|
+
```ts
|
|
7798
|
+
readonly lookSensitivity: number
|
|
7799
|
+
```
|
|
7800
|
+
|
|
7801
|
+
The player's look speed for touch, mouse and pen, as a percentage of the
|
|
7802
|
+
base speeds: `100` is 1×, from `20` (0.2×) to `400` (4×). `100` when the
|
|
7803
|
+
Arcade did not say. `gem.controls.look()` applies it for you.
|
|
7804
|
+
|
|
7805
|
+
<a id="gemrecommendedsettings-gamepadlooksensitivity"></a>
|
|
7806
|
+
|
|
7807
|
+
## GemRecommendedSettings.gamepadLookSensitivity
|
|
7808
|
+
|
|
7809
|
+
```ts
|
|
7810
|
+
readonly gamepadLookSensitivity: number
|
|
7811
|
+
```
|
|
7812
|
+
|
|
7813
|
+
The player's look speed for a gamepad stick, as a percentage: `100` is 1×,
|
|
7814
|
+
from `20` to `400`. `100` when the Arcade did not say.
|
|
7815
|
+
`gem.controls.look()` applies it for you.
|
|
7816
|
+
|
|
7817
|
+
<a id="gemrecommendedsettings-invertlooky"></a>
|
|
7818
|
+
|
|
7819
|
+
## GemRecommendedSettings.invertLookY
|
|
7820
|
+
|
|
7821
|
+
```ts
|
|
7822
|
+
readonly invertLookY: boolean
|
|
7823
|
+
```
|
|
7824
|
+
|
|
7825
|
+
Whether the player wants up/down look inverted: pushing up or dragging up
|
|
7826
|
+
looks down. Flips pitch only, never yaw. `false` when the Arcade did not
|
|
7827
|
+
say. `gem.controls.look()` applies it for you.
|
|
7828
|
+
|
|
7829
|
+
<a id="gemrecommendedsettings-touchmovement"></a>
|
|
7830
|
+
|
|
7831
|
+
## GemRecommendedSettings.touchMovement
|
|
7832
|
+
|
|
7833
|
+
```ts
|
|
7834
|
+
readonly touchMovement: "floating" | "fixed"
|
|
7835
|
+
```
|
|
7836
|
+
|
|
7837
|
+
On a touch screen, the movement thumbstick the player wants: `'floating'`
|
|
7838
|
+
appears where the thumb lands, `'fixed'` stays in one place. `'floating'`
|
|
7839
|
+
when the Arcade did not say. Your game draws the stick.
|
|
7840
|
+
|
|
7356
7841
|
<a id="gemcohort"></a>
|
|
7357
7842
|
|
|
7358
7843
|
## GemCohort
|
|
@@ -7514,10 +7999,11 @@ The unsafe margin on each edge of your frame.
|
|
|
7514
7999
|
readonly reserved: readonly GemReservedArea[]
|
|
7515
8000
|
```
|
|
7516
8001
|
|
|
7517
|
-
Rectangles of your frame the arcade's own controls cover —
|
|
7518
|
-
in the top-
|
|
7519
|
-
|
|
7520
|
-
|
|
8002
|
+
Rectangles of your frame the arcade's own controls cover — in the Gem
|
|
8003
|
+
Arcade, its Gem button in the top-left corner, and the frame-rate readout
|
|
8004
|
+
beside it while the player shows it; an embedder that draws wallets over
|
|
8005
|
+
your game adds theirs (see `setWalletVisible`). Keep essential UI and touch
|
|
8006
|
+
targets out of them. Empty when the arcade covers nothing.
|
|
7521
8007
|
|
|
7522
8008
|
A stylesheet reads the per-corner custom properties the SDK stamps from
|
|
7523
8009
|
these instead — `--gem-reserved-tl-height` and friends.
|
|
@@ -7596,8 +8082,8 @@ While shown, show ONLY these: platform currency slugs as
|
|
|
7596
8082
|
`gem.platform.currencies.get()` lists them (`GEMS`, `ARCADE_TICKETS`),
|
|
7597
8083
|
matched exactly, and the literal `'score'` for the achievement score. Only
|
|
7598
8084
|
for a screen about one currency, such as a ticket store; leave it out and
|
|
7599
|
-
every wallet shows, which is always safe. The Gem Arcade
|
|
7600
|
-
|
|
8085
|
+
every wallet shows, which is always safe. The Gem Arcade draws no wallet
|
|
8086
|
+
over a game, so it has nothing to narrow and ignores it.
|
|
7601
8087
|
|
|
7602
8088
|
<a id="gamemenuitem"></a>
|
|
7603
8089
|
|
|
@@ -8223,6 +8709,32 @@ function onHit() {
|
|
|
8223
8709
|
|
|
8224
8710
|
**Guides.** [vibration](../vibration.md)
|
|
8225
8711
|
|
|
8712
|
+
<a id="gem-controls"></a>
|
|
8713
|
+
|
|
8714
|
+
## Gem.controls
|
|
8715
|
+
|
|
8716
|
+
```ts
|
|
8717
|
+
readonly controls: ControlsApi
|
|
8718
|
+
```
|
|
8719
|
+
|
|
8720
|
+
The player's camera and controls settings — look sensitivity, gamepad look
|
|
8721
|
+
sensitivity, invert look and touch movement, which arrive in
|
|
8722
|
+
`gem.prefs.recommended`. Two things to do with them:
|
|
8723
|
+
|
|
8724
|
+
```js
|
|
8725
|
+
// 1. Tell the Arcade which ones your game leaves to the player.
|
|
8726
|
+
gem.controls.declare({ lookSensitivity: 'player', invertLookY: 'player' });
|
|
8727
|
+
|
|
8728
|
+
// 2. Turn look input into a camera turn at the player's sensitivity.
|
|
8729
|
+
const look = gem.controls.look();
|
|
8730
|
+
// dx, dy: the pointer's move in CSS px since the last event.
|
|
8731
|
+
const t = look.fromPointer(dx, dy, e.pointerType, camera.pitch);
|
|
8732
|
+
camera.yaw += t.yaw;
|
|
8733
|
+
camera.pitch += t.pitch;
|
|
8734
|
+
```
|
|
8735
|
+
|
|
8736
|
+
See the guide's "Camera and look controls" section.
|
|
8737
|
+
|
|
8226
8738
|
<a id="gem-analytics"></a>
|
|
8227
8739
|
|
|
8228
8740
|
## Gem.analytics
|
|
@@ -8574,10 +9086,13 @@ is ignored by the arcade, which keeps the image it is showing.
|
|
|
8574
9086
|
cueReward(cue: RewardCue): boolean
|
|
8575
9087
|
```
|
|
8576
9088
|
|
|
8577
|
-
Tell the arcade a platform-currency reward is on its way, so
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
9089
|
+
Tell the arcade a platform-currency reward is on its way, so it **shows it
|
|
9090
|
+
landing**: in the Gem Arcade the currency flies from `origin` into the Gem
|
|
9091
|
+
button at the top-left of your frame, which pops as each mark lands, and
|
|
9092
|
+
the player's total moves once the platform confirms the grant. The Gem
|
|
9093
|
+
Arcade draws no wallet over your game: the player sees their Gems and
|
|
9094
|
+
Tickets in the Gem menu. A payout you do not cue still flies, from the
|
|
9095
|
+
middle of your frame, so cue the ones the player earns on screen.
|
|
8581
9096
|
|
|
8582
9097
|
Call it the moment your game decides to award — when your server has moved
|
|
8583
9098
|
(or is about to move) the progression mapped onto a platform currency —
|
|
@@ -8625,28 +9140,23 @@ setWalletVisible(visible: boolean, options?: WalletVisibleOptions): boolean
|
|
|
8625
9140
|
Show or hide the player's wallets — Gems, Tickets, the achievement score —
|
|
8626
9141
|
that an embedder draws over your game.
|
|
8627
9142
|
|
|
8628
|
-
**
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
9143
|
+
**The Gem Arcade draws no wallet over a game** (since 2026-10-11): the
|
|
9144
|
+
player sees their balances in the Gem menu, and payouts fly into the Gem
|
|
9145
|
+
button. So under the Gem Arcade this changes nothing on screen — it is
|
|
9146
|
+
accepted and harmless, and a game that already calls it keeps working.
|
|
9147
|
+
Call it for an embedder that does draw wallets over your game: hide them
|
|
9148
|
+
while you play, show them on your menus.
|
|
8634
9149
|
|
|
8635
9150
|
```js
|
|
8636
9151
|
level.onStart = () => gem.setWalletVisible(false);
|
|
8637
9152
|
menu.onOpen = () => gem.setWalletVisible(true);
|
|
8638
9153
|
```
|
|
8639
9154
|
|
|
8640
|
-
The Gem Arcade does NOT act on `only`: a shown wallet there is every
|
|
8641
|
-
wallet. Another embedder may honour it.
|
|
8642
|
-
|
|
8643
9155
|
**It is screen state, not a toggle.** Each call is the whole answer and
|
|
8644
|
-
replaces the last.
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
`gem.viewport.reserved`; hiding them gives that space back. A wallet the
|
|
8649
|
-
arcade pops up for a moment floats over your game and moves nothing.
|
|
9156
|
+
replaces the last. Where an embedder draws wallets, shown ones arrive as
|
|
9157
|
+
rectangles in `gem.viewport.reserved` and hiding them gives that space
|
|
9158
|
+
back; the Gem Arcade sends none for wallets. `only` narrows what shows,
|
|
9159
|
+
where an embedder honours it; the Gem Arcade does not.
|
|
8650
9160
|
|
|
8651
9161
|
**Never draw a platform balance yourself**, and never show a pending state
|
|
8652
9162
|
for one: the arcade takes every figure from the platform. If this returns
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The server surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk` v10.
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v10.3.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/server` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|