@air-jam/cli 0.9.3 → 1.0.0-beta.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.
Files changed (94) hide show
  1. package/README.md +128 -0
  2. package/dist/auth-profile.d.ts +5 -0
  3. package/dist/auth-profile.js +7 -0
  4. package/dist/auth-profile.js.map +1 -0
  5. package/dist/auth-sessions.d.ts +5 -0
  6. package/dist/auth-sessions.js +7 -0
  7. package/dist/auth-sessions.js.map +1 -0
  8. package/dist/chunk-7D4AYBAV.js +64 -0
  9. package/dist/chunk-7D4AYBAV.js.map +1 -0
  10. package/dist/chunk-LH7UO57C.js +23 -0
  11. package/dist/chunk-LH7UO57C.js.map +1 -0
  12. package/dist/chunk-PKTLVQXZ.js +82 -0
  13. package/dist/chunk-PKTLVQXZ.js.map +1 -0
  14. package/dist/chunk-SQE4NPZP.js +31 -0
  15. package/dist/chunk-SQE4NPZP.js.map +1 -0
  16. package/dist/{chunk-A4V2N4LX.js → chunk-U6V3HEBB.js} +6 -5
  17. package/dist/chunk-U6V3HEBB.js.map +1 -0
  18. package/dist/chunk-VEHNFPEO.js +224 -0
  19. package/dist/chunk-VEHNFPEO.js.map +1 -0
  20. package/dist/development.d.ts +4 -0
  21. package/dist/development.js +1 -1
  22. package/dist/game-analytics.d.ts +5 -0
  23. package/dist/game-analytics.js +7 -0
  24. package/dist/game-analytics.js.map +1 -0
  25. package/dist/game-app-id.d.ts +5 -0
  26. package/dist/game-app-id.js +7 -0
  27. package/dist/game-app-id.js.map +1 -0
  28. package/dist/game-media.d.ts +5 -0
  29. package/dist/game-media.js +7 -0
  30. package/dist/game-media.js.map +1 -0
  31. package/dist/index.js +688 -404
  32. package/dist/index.js.map +1 -1
  33. package/package.json +8 -4
  34. package/runtime/local-network.d.mts +4 -6
  35. package/runtime/public-assets.mjs +62 -0
  36. package/runtime/source-fence.mjs +182 -0
  37. package/runtime/vite-config.d.mts +2 -1
  38. package/runtime/vite-config.mjs +6 -2
  39. package/runtime/vite-dev.mjs +18 -0
  40. package/runtime/vite-https.mjs +2 -3
  41. package/template-assets/bootstrap/AGENTS.md +56 -14
  42. package/template-assets/bootstrap/CLAUDE.md +0 -8
  43. package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +44 -0
  44. package/template-assets/bootstrap/skills/controller-ui/SKILL.md +2 -0
  45. package/template-assets/bootstrap/skills/game-architecture/SKILL.md +47 -3
  46. package/template-assets/bootstrap/skills/index.md +1 -1
  47. package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +10 -0
  48. package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +10 -0
  49. package/template-assets/documentation/for-agents/controller-ui/page.mdx +41 -2
  50. package/template-assets/documentation/for-agents/page.mdx +24 -2
  51. package/template-assets/documentation/for-agents/project-structure/page.mdx +0 -2
  52. package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +0 -2
  53. package/template-assets/documentation/for-agents/supported-agents/page.mdx +18 -0
  54. package/template-assets/documentation/getting-started/debugging/page.mdx +7 -8
  55. package/template-assets/documentation/getting-started/dev-logs/page.mdx +0 -2
  56. package/template-assets/documentation/getting-started/game-ideas/page.mdx +1 -3
  57. package/template-assets/documentation/getting-started/introduction/page.mdx +71 -54
  58. package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +308 -62
  59. package/template-assets/documentation/getting-started/quick-start/page.mdx +56 -79
  60. package/template-assets/documentation/how-it-works/architecture/page.mdx +91 -50
  61. package/template-assets/documentation/how-it-works/host-system/page.mdx +112 -109
  62. package/template-assets/documentation/manifest.json +112 -42
  63. package/template-assets/documentation/sdk/assets-and-theme/page.mdx +185 -0
  64. package/template-assets/documentation/sdk/hooks/page.mdx +106 -171
  65. package/template-assets/documentation/sdk/input-system/page.mdx +201 -231
  66. package/template-assets/documentation/sdk/networked-state/page.mdx +134 -52
  67. package/template-assets/documentation/sdk/settings/page.mdx +155 -0
  68. package/template-assets/documentation/sdk/ui-components/page.mdx +45 -4
  69. package/template-assets/managed/.airjam/ai-pack.json +61 -43
  70. package/template-assets/managed/docs/airjam/agent-gold-path.md +55 -7
  71. package/template-assets/managed/docs/airjam/agent-mcp.md +44 -0
  72. package/template-assets/managed/docs/airjam/debug-and-testing.md +18 -0
  73. package/template-assets/managed/docs/airjam/docs-index.md +18 -12
  74. package/template-assets/managed/docs/airjam/generated/architecture.md +91 -46
  75. package/template-assets/managed/docs/airjam/generated/assets-and-theme.md +188 -0
  76. package/template-assets/managed/docs/airjam/generated/controller-ui.md +41 -0
  77. package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +7 -6
  78. package/template-assets/managed/docs/airjam/generated/for-agents.md +24 -0
  79. package/template-assets/managed/docs/airjam/generated/game-ideas.md +1 -1
  80. package/template-assets/managed/docs/airjam/generated/host-system.md +112 -102
  81. package/template-assets/managed/docs/airjam/generated/input-system.md +199 -218
  82. package/template-assets/managed/docs/airjam/generated/introduction.md +71 -51
  83. package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +308 -60
  84. package/template-assets/managed/docs/airjam/generated/networked-state.md +134 -50
  85. package/template-assets/managed/docs/airjam/generated/quick-start.md +56 -79
  86. package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +106 -166
  87. package/template-assets/managed/docs/airjam/generated/settings.md +158 -0
  88. package/template-assets/managed/docs/airjam/generated/supported-agents.md +21 -0
  89. package/template-assets/managed/docs/airjam/generated/ui-components.md +45 -2
  90. package/template-assets/managed/docs/airjam/prefab-authoring.md +100 -0
  91. package/template-assets/managed/docs/airjam/preview-controllers.md +4 -1
  92. package/template-assets/managed/docs/airjam/r3f-3d-scene.md +66 -0
  93. package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +15 -20
  94. package/dist/chunk-A4V2N4LX.js.map +0 -1
@@ -1,270 +1,240 @@
1
-
2
-
3
1
  # Input System
4
2
 
5
- The Air Jam input system provides type-safe, validated controller input with clear behavior semantics.
6
-
7
- ## Input Flow
8
-
3
+ A game declares the controls each player has. Phones, agents and replays fill
4
+ those controls; the host reads them once per simulation step, with a fixed
5
+ meaning for each kind of control.
9
6
 
10
- <InputFlowDiagram />
7
+ ## Declare Controls
11
8
 
12
- ## Configuration
13
-
14
- Configure input in your canonical Air Jam app setup:
15
-
16
- ```tsx filename="src/airjam.config.ts"
17
- import { createAirJamApp, env } from "@air-jam/sdk";
18
- import { z } from "zod";
19
-
20
- const gameInputSchema = z.object({
21
- vector: z.object({ x: z.number(), y: z.number() }),
22
- action: z.boolean(),
23
- ability: z.boolean(),
24
- timestamp: z.number(),
9
+ ```ts
10
+ // src/game/contracts/input.ts
11
+ import {
12
+ button,
13
+ defineAirJamInput,
14
+ stick,
15
+ type AirJamInputValues,
16
+ } from "@air-jam/sdk/core";
17
+
18
+ export const shipInput = defineAirJamInput({
19
+ move: stick(),
20
+ fire: button("pressed"),
21
+ boost: button("held"),
25
22
  });
26
23
 
27
- type GameInput = z.infer<typeof gameInputSchema>;
28
-
29
- export const airjam = createAirJamApp({
30
- runtime: env.vite(import.meta.env),
31
- controllerPath: "/controller",
32
- input: {
33
- schema: gameInputSchema,
34
- },
35
- });
24
+ export type ShipInput = AirJamInputValues<typeof shipInput>;
36
25
  ```
37
26
 
38
- ## Default Behavior (No Extra Config)
39
-
40
- Without any `input.behavior` overrides:
41
-
42
- - booleans use `pulse` (tap-safe consume-on-read)
43
- - vectors use `latest` (continuous current value)
44
- - all other fields use `latest`
45
-
46
- This default is the canonical path for most games.
47
-
48
- ## Optional Behavior Overrides
49
-
50
- Use `input.behavior` only when your game has specialized needs.
27
+ Declare them once in `src/airjam.config.ts` with `defineAirJamGame` from `@air-jam/sdk/core`:
51
28
 
52
- ```tsx filename="src/airjam.config.ts"
53
- export const airjam = createAirJamApp({
54
- runtime: env.vite(import.meta.env),
55
- controllerPath: "/controller",
56
- input: {
57
- schema: gameInputSchema,
58
- behavior: {
59
- pulse: ["action", "ability"],
60
- latest: ["vector"],
61
- hold: ["menuVector"],
62
- },
63
- },
29
+ ```ts
30
+ export const airjam = defineAirJamGame({
31
+ // ...
32
+ simulation: shipSimulation,
33
+ input: shipInput,
64
34
  });
65
35
  ```
66
36
 
67
- Behavior modes:
68
-
69
- - `pulse`: consume-on-read, ideal for one-shot actions (jump/fire/confirm)
70
- - `latest`: current value only, ideal for movement sticks
71
- - `hold`: vectors keep last non-zero direction until next non-zero value
72
-
73
- ## Migration From `latch`
74
-
75
- Old config:
76
-
77
- ```tsx
78
- input: {
79
- schema: gameInputSchema,
80
- latch: {
81
- booleanFields: ["action"],
82
- vectorFields: ["vector"],
37
+ ## Control Kinds
38
+
39
+ | Kind | Declared as | A step reads |
40
+ | ------------------------------ | -------------------------------- | ------------------------------------------------------------------------------------------ |
41
+ | Held button | `button("held")` | `true` while the button is down, and for at least one step after a tap shorter than a step |
42
+ | Pressed button | `button("pressed")` | `true` for exactly one step per press |
43
+ | Axis | `axis()` | a number from -1 to 1 |
44
+ | Stick | `stick()` | `{ x, y }`, each from -1 to 1; `y` is down, like screen space |
45
+ | Stick that keeps its direction | `stick({ keepDirection: true })` | the last direction while the stick is centred, as in snake |
46
+
47
+ Presses travel as a counter, so a tap between two network packets or two
48
+ simulation steps is never lost or doubled. Games never debounce or latch input
49
+ themselves.
50
+
51
+ ## Read Controls In The Simulation
52
+
53
+ Input reaches a game only in its simulation steps:
54
+
55
+ ```ts
56
+ export const shipSimulation = defineAirJamSimulation<Sim, ShipInput>({
57
+ stepMs: 1000 / 60,
58
+ create: () => createSim(),
59
+ step: (sim, { input, players, dtSeconds }) => {
60
+ for (const player of players) {
61
+ const { move, fire, boost } = input(player.id);
62
+ steer(sim, player.id, move, boost, dtSeconds);
63
+ if (fire) shoot(sim, player.id);
64
+ }
83
65
  },
84
- }
85
- ```
86
-
87
- New config:
88
-
89
- ```tsx
90
- input: {
91
- schema: gameInputSchema,
92
- behavior: {
93
- pulse: ["action"],
94
- latest: ["vector"],
95
- },
96
- }
66
+ });
97
67
  ```
98
68
 
99
- For most games, remove the override entirely and keep `input: { schema }`.
69
+ `input(playerId)` always returns every control. A player who has sent nothing
70
+ yet reads as released and centred.
100
71
 
101
- ## Schema Validation
72
+ ## Phone Controls
102
73
 
103
- When you provide a Zod schema, incoming input is validated before your game reads it.
74
+ The SDK's phone controls fill the declared controls and send them; a game
75
+ never runs its own send loop.
104
76
 
105
77
  ```tsx
106
- // ✅ valid input
107
- {
108
- vector: { x: 0.5, y: -0.3 },
109
- action: true,
110
- ability: false,
111
- timestamp: 1703123456789,
112
- }
113
-
114
- // ❌ invalid input (returns undefined + warning)
115
- {
116
- vector: { x: "bad", y: 0 },
117
- action: true,
118
- }
119
- ```
120
-
121
- Benefits:
122
-
123
- - typed `getInput()` values
124
- - malformed payloads blocked before gameplay logic
125
- - clear runtime warnings during development
78
+ import { AxisButton, ControlButton, Stick } from "@air-jam/sdk/ui";
126
79
 
127
- ## Reading Input
128
-
129
- ### Main Host Loop
130
-
131
- This example uses the starter host surface path.
132
- Treat it as a recommended default, not a required filename.
133
- It assumes your app has already mounted `airjam.Host` above this view.
134
-
135
- ```tsx filename="src/host/index.tsx"
136
- import { useAirJamHost } from "@air-jam/sdk";
137
- import { useFrame } from "@react-three/fiber";
138
-
139
- const HostView = () => {
140
- const host = useAirJamHost();
141
-
142
- useFrame(() => {
143
- host.players.forEach((player) => {
144
- const input = host.getInput(player.id);
145
- if (!input) return;
146
-
147
- movePlayer(player.id, input.vector);
148
-
149
- if (input.action) {
150
- playerShoot(player.id);
151
- }
152
- });
153
- });
154
-
155
- return <GameScene />;
156
- };
80
+ <Stick control={shipInput.move} className="size-48 rounded-full bg-zinc-900" />
81
+ <ControlButton control={shipInput.fire} className="bg-red-500 data-[active=true]:ring-2">
82
+ Fire
83
+ </ControlButton>
157
84
  ```
158
85
 
159
- ### Performance-Critical Components
86
+ 1. `ControlButton` binds a button. Each touch, or Space and Enter while it has
87
+ focus, is one press.
88
+ 2. `AxisButton` holds an axis at a value while held, such as a paddle's up and
89
+ down buttons. The latest held button wins.
90
+ 3. `Stick` reads a drag anywhere inside it. `directions="4-way"` snaps it to a
91
+ pad, `deadzone` keeps small offsets centred, and a function child draws the
92
+ whole stick. It stays correct however the controller surface is rotated.
160
93
 
161
- Use `useGetInput()` to avoid store-driven re-renders:
94
+ Every control sets `data-active` while held, so games style the held state
95
+ with their own classes. Controls release when the phone page loses focus.
162
96
 
163
- ```tsx filename="src/game/components/ship.tsx"
164
- import { useGetInput } from "@air-jam/sdk";
97
+ The controller sends its controls once per display frame when they change, again
98
+ after joining, and on a slow keepalive. Nothing stamps input with a device
99
+ clock.
165
100
 
166
- const Ship = ({ playerId }: { playerId: string }) => {
167
- const getInput = useGetInput<typeof gameInputSchema>();
101
+ ## Keyboards And Gamepads
168
102
 
169
- useFrame(() => {
170
- const input = getInput(playerId);
171
- if (!input) return;
103
+ Declare bindings for the controls and every keyboard layout and gamepad plays
104
+ as a local player, with no phone:
172
105
 
173
- shipRef.current.position.x += input.vector.x * SPEED;
174
- shipRef.current.position.y += input.vector.y * SPEED;
175
- });
176
-
177
- return <mesh ref={shipRef}>...</mesh>;
178
- };
179
- ```
180
-
181
- ## Controller Cadence
182
-
183
- Use `useInputWriter()` with `useControllerTick()` for fixed-cadence publishing:
184
-
185
- This example uses the starter controller surface path.
186
- It assumes your app has already mounted `airjam.Controller` above this view.
187
-
188
- ```tsx filename="src/controller/index.tsx"
106
+ ```ts
189
107
  import {
190
- useAirJamController,
191
- useControllerTick,
192
- useInputWriter,
193
- } from "@air-jam/sdk";
194
- import { useRef } from "react";
195
-
196
- const ControllerView = () => {
197
- const controller = useAirJamController();
198
- const writeInput = useInputWriter();
199
- const directionRef = useRef(0);
200
-
201
- useControllerTick(
202
- () => {
203
- writeInput({
204
- direction: directionRef.current,
205
- action: false,
206
- });
207
- },
208
- {
209
- enabled:
210
- controller.connectionStatus === "connected" &&
211
- controller.runtimeState === "playing",
212
- intervalMs: 16,
213
- },
214
- );
215
- };
216
- ```
217
-
218
- ## Best Practices
219
-
220
- ### 1. Keep Input and State in Separate Lanes
221
-
222
- - Input lane: `useInputWriter` + `getInput` / `useGetInput`
223
- - State lane: `createAirJamStore` + `useActions`
224
-
225
- Do not send per-frame analog input via store actions.
226
-
227
- ### 2. Keep Quickstart Config Minimal
228
-
229
- Start with `input: { schema }`. Add `input.behavior` only for non-default needs.
230
-
231
- ### 3. Handle Missing Input Gracefully
232
-
233
- ```tsx filename="src/components/Player.tsx"
234
- const input = getInput(playerId);
235
- if (!input) return;
236
-
237
- movePlayer(input.vector);
238
- ```
239
-
240
- ### 4. Include Timestamps for Advanced Physics
108
+ arrows,
109
+ button,
110
+ defineAirJamInput,
111
+ defineAirJamInputBindings,
112
+ stick,
113
+ wasd,
114
+ } from "@air-jam/sdk/core";
115
+
116
+ export const shipInput = defineAirJamInput({
117
+ move: stick(),
118
+ fire: button("pressed"),
119
+ boost: button("held"),
120
+ });
241
121
 
242
- ```tsx filename="src/game/types.ts"
243
- const inputSchema = z.object({
244
- vector: z.object({ x: z.number(), y: z.number() }),
245
- action: z.boolean(),
246
- timestamp: z.number(),
122
+ export const shipInputBindings = defineAirJamInputBindings(shipInput, {
123
+ keyboard: [
124
+ { move: wasd(), fire: "Space", boost: "ShiftLeft" },
125
+ { move: arrows(), fire: "Enter", boost: "ShiftRight" },
126
+ ],
127
+ gamepad: { move: "leftStick", fire: "south", boost: "rightTrigger" },
247
128
  });
248
129
 
249
- const inputAge = Date.now() - input.timestamp;
130
+ // airjam.config.ts
131
+ defineAirJamGame({ input: shipInput, inputBindings: shipInputBindings, ... });
250
132
  ```
251
133
 
252
- ## Common Issues
134
+ 1. Each keyboard layout is one player; every connected gamepad is one more.
135
+ Keys are `KeyboardEvent.code` values. A button binds one or more keys, an
136
+ axis binds `keyAxis(negative, positive)`, and a stick binds `wasd()`,
137
+ `arrows()` or `keyStick({ up, left, down, right })`. A binding for a
138
+ control that isn't declared, or of the wrong kind, throws when declared.
139
+ 2. Gamepad names follow the standard layout: `south`, `east`, `west`,
140
+ `north`, `leftBumper`, `rightBumper`, `leftTrigger`, `rightTrigger`,
141
+ `select`, `start`, stick presses and the d-pad for buttons;
142
+ `leftStickX`/`Y` and `rightStickX`/`Y` for axes; `leftStick`, `rightStick`
143
+ or `dpad` for sticks. Sticks get a small deadzone and stay y down.
144
+ 3. A layout's first key, or a gamepad's first button or stick push, opens a
145
+ seat: a preview phone named "Keyboard 1" or "Gamepad 1" that joins like any
146
+ phone. Its own screen answers menus and lobby buttons; the keys or buttons
147
+ drive play. Minimizing that phone keeps it playing; removing it frees the
148
+ seat, and the next key opens a new one.
149
+ 4. Keys and gamepads count only while the game page has focus, key repeats
150
+ never press, and losing focus or unplugging a gamepad releases what it
151
+ held. Keys aimed at the page's own buttons and fields stay theirs.
152
+
153
+ Local development's preview phones and Studio provide these seats; a page
154
+ with nobody to provide them leaves keys and gamepads alone. Game code never
155
+ listens to keys or polls gamepads itself.
156
+
157
+ A product framing a game offers its preview workspace's phones as that
158
+ game's seats by passing the game frame to `PreviewControllerWorkspace` as
159
+ `localPlayersGame`; `localPlayers={false}` offers none and closes the seats
160
+ it opened. The Arcade offers them only once a player turns keyboard and
161
+ gamepad players on.
162
+
163
+ A product framing its own phones launches each with
164
+ `createPreviewControllerLaunch` from `@air-jam/sdk/preview`, passing its
165
+ page's origin as `parentOrigin` and, for a seat, its label as `localSeat`. A
166
+ phone takes seat input and close requests only from its direct parent at that
167
+ origin, and answers only there; without `parentOrigin` that is the phone's own
168
+ origin, as the preview workspace launches it.
169
+
170
+ ## Agents
171
+
172
+ Agents fill the same controls through leased participant control. They send
173
+ values: a button is `true` or `false`, an axis a number and a stick an
174
+ `{ x, y }`. A button going from `false` to `true` is one press; to press again,
175
+ send `false` and then `true`. The input description agents read comes from the
176
+ declaration.
177
+
178
+ ## Input Log And Replays
179
+
180
+ Every host whose game declares a simulation keeps a version 2 input log,
181
+ from construction, in the browser as well as headless. It contains the real
182
+ seed, resolved initial settings, players joining and leaving, room state,
183
+ store actions applied between steps, controls when they change and accepted
184
+ settings updates. Each event carries the step it reached the game before.
185
+ Actions a step causes replay with the simulation and are not logged again.
186
+ `runtime.inputLog()` reads it locally; it throws while the simulation is
187
+ loading or when the game declares none.
188
+
189
+ The recorder retains the start of the match. It freezes before a step would
190
+ exceed 30 minutes of played game time or 16 MiB (the sum of each entry's JSON
191
+ length). A full log ends at the last whole step and excludes pending events.
192
+ `runtime.inputLogFull` reports this without changing the version 2 format.
193
+ Reload the game to start a new recording.
194
+
195
+ Agents use `readHostInputLog(request, observation.identity)` from
196
+ `@air-jam/sdk/runtime-control` through the existing host-agent channel. It
197
+ returns `{ status: "recorded", log, full }`, or `{ status: "not-replayable",
198
+ reason, message }`. Reasons are `no-simulation`, `loading`, `runtime-replaced`
199
+ and `host-unavailable`. A game without a simulation says:
200
+ "This game has no simulation, so its matches cannot be replayed; record a clip instead."
201
+ Reading needs no room grant. The first `input-log-read` request fixes a cut;
202
+ later pages read the same prefix while the match keeps playing.
203
+
204
+ Headless runs keep the log in their evidence. Running
205
+
206
+ ```bash
207
+ airjam session run replay <run-id>
208
+ ```
253
209
 
254
- ### Input Not Received
210
+ plays it on a fresh copy of the game, with no server or page, and reports
211
+ whether the replay ends where the run ended.
212
+ `replayAirJamInputLog(airjam.createHostRuntime, log)` from
213
+ `@air-jam/sdk/core` remains the run-to-completion form.
214
+
215
+ For playback, `await openAirJamReplay(airjam.createHostRuntime, log)` returns
216
+ `{ runtime, roomId, agent, stop, stepMs, ticks, tick, done, advance }`.
217
+ It stays paused between calls. `advance({ steps: 10 })` runs whole steps;
218
+ `advance({ ms: elapsed * speed })` carries fractions between calls, so a
219
+ caller can drive any speed per animation frame. Both return the current tick
220
+ and clamp at `ticks`. Reaching the end applies events after the final step
221
+ once, including on a recording with zero steps. Call `stop()` when finished.
222
+
223
+ There is no backward seek. Open a new replay and advance to the desired tick.
224
+ Each replay needs a fresh load of the same game source, in its own page or
225
+ headless process: game stores are module singletons and cannot share the load
226
+ with the live game or another replay. Exact replay also requires game code to
227
+ draw randomness from the step's seeded `random`.
255
228
 
256
- 1. Check host connection status (`connected`)
257
- 2. Verify room code matches on host and controller
258
- 3. Check schema warnings in console (`[InputManager] Invalid input ...`)
229
+ ## Common Issues
259
230
 
260
- ### Input Feels Laggy
231
+ ### A Control Does Nothing
261
232
 
262
- 1. Use `useGetInput()` inside game objects
263
- 2. Verify your controller tick cadence (typically `16ms`)
264
- 3. Check network latency (include timestamps in schema)
233
+ 1. Check the control is declared and passed to `defineAirJamGame({ input })`.
234
+ 2. Read it in the simulation step; the host has no other way to read input.
235
+ 3. Render phone controls inside `<airjam.Controller>`.
265
236
 
266
- ### Buttons Feel Unreliable
237
+ ### A Tap Fires Twice Or Not At All
267
238
 
268
- 1. Confirm the field is boolean in your schema
269
- 2. Keep default behavior (`pulse`) for action buttons
270
- 3. Avoid dispatching button presses through store actions
239
+ Use `button("pressed")` for one-shot actions, which then read `true` once per
240
+ press, and `button("held")` for actions that last while held.