Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

GameProps

  • PropsWithChildren
Property Type Default value Description
defaultVoiceMode? VoiceMode VoiceMode.PushToTalk What a player’s talk key does when the player starts, such as VoiceMode.OpenMic for a game played with friends, and what Reset puts back. The player’s microphone starts off either way. A mode the player saved on this device keeps its value. Read once, when Game mounts.
defaultVolumes? Partial<Pick<PlayerSettings, "masterVolume" | "musicVolume" | "effectsVolume" | "interfaceVolume" | "voiceVolume">> music at 60, 20 dB under the effects, and every other volume at 100 The game’s own mix: where the player’s volume sliders start, such as { musicVolume: 100 } for music as loud as the effects, and what Reset puts them back to. A volume the player saved on this device keeps its value. Read once, when Game mounts.
devtools? false | DevtoolsLoader none The game’s devtools module, as src/app/devtools.tsx default exports its <Devtools>: Game loads it once, as it mounts, and mounts it after the game’s own DOM. The game passes import.meta.env.DEV && (() => import("./devtools")), so a production build drops the import and the module behind it; the engine’s Vite plugin fails a production build that still holds the devtools. A game that mounts its own tooling in a build passes none and mounts it as a child instead.
game GameDescriptor undefined The game, as src/game.ts exports it from defineGame: its name, the scene that opens, its plugins, composed once as that module loaded, its physics scene and its levels. The room loads the same export from the scene’s file, and a page whose composition differs from its room’s is refused at the welcome. Each plugin’s component wraps the scenes and the game’s DOM, in list order. A new descriptor, as a hot update to the game’s module makes, makes a new world.
gl? RendererFactory | RendererOptions fiber’s: a WebGLRenderer with powerPreference: "high-performance", antialias and alpha The canvas’s renderer, as fiber’s Canvas takes it: the settings three’s WebGLRenderer is made with, such as { stencil: true } for a portal’s mask or { logarithmicDepthBuffer: true } for a planet’s scale, over fiber’s defaults; or a factory that makes the renderer from the canvas and those defaults, and may return a promise. A factory that returns a WebGPURenderer runs the experimental WebGPU mode, where every engine part that needs WebGL is off and says so once in the console. Settings changed at run time, such as tone mapping, go through useThree. Read once, when Game mounts; a scene mounted headless, as a room’s server and simulate mount it, reads none of it, and its useThree renderer is a stand-in that draws nothing. Where the game passes none, the page’s address picks: ?renderer=webgpu for the WebGPU mode, webgl for the default, and any other value is refused.
loadingScreen? false | LoadingScreenPick the engine’s LoadingScreen, undressed What covers the game from the page’s first paint until its first playable frame: the engine’s loading screen, dressed with the game’s name, a line, tips and art where given them; a component of the game’s own; or nothing, with false.
menu? boolean true Whether the engine’s Play menu mounts, which Escape and a fullscreen’s exit open. false for a page that mounts the engine without being a game, such as a model viewer: no menu, and Escape stays the page’s.
onCreated? (state) => void undefined Called once the canvas has made its renderer, scene and camera, before its first frame, with fiber’s state and the renderer the game’s gl made. Read once, when Game mounts.
orientation? GameOrientation GameOrientation.Any How the game is held on a touch screen. Held the other way, a full screen covers it and asks the player to turn the screen, since a browser cannot lock the turn on iOS, and elsewhere only in fullscreen. It reads every coarse pointer, a tablet’s too, as Unity’s Default Orientation, Roblox’s ScreenOrientation and Godot’s handheld orientation hold for every handheld. Named apart from the DOM’s own ScreenOrientation.
page? boolean true Whether Game holds the page it is mounted on, as a game’s page wants: the page clips to the screen and never scrolls or pulls to refresh, every scroll area draws the game’s scrollbar, the mouse’s middle and side buttons start no autoscroll and no back or forward, and a finger on the canvas moves only the game. In development, an element that reaches past the screen is named in the console. false for a page that mounts the engine without being a game, such as a model viewer in a page that scrolls: the page stays the page’s, and only the canvas cancels the middle and side buttons. Game marks the page’s root with data-game-page while it holds the page, and ui’s stylesheet reads the mark.
products? Readonly<Record<string, unknown>> none: the game sells nothing The game’s products, as defineProducts declares them in src/products.ts: useProducts checks a purchase’s context against them, and in a game with no rooms the page runs a consumable’s grant when the app hands it the purchase. A room reads the same declaration from its scene’s file. Read once, when Game mounts.
quality? QualityOptions the engine's levels and start levels; dynamic resolution on where the main pointer is a finger, between half and the whole pixel ratio What the game changes about graphics quality: what each level draws, over the engine’s own, the level each device class starts at under Automatic, and dynamic resolution’s default and bounds. The engine detects the device, picks Automatic’s level and applies it with none. Read once, when Game mounts.
replicas? boolean true Whether the engine draws the room stream where the scene places no Replicas. A placed Replicas takes over while mounted. false for a game that draws the streamed entities itself with useEntityRef. Ignored when playing alone. Read once, when Game makes its world.
respawnScreen? false | ComponentType<RespawnScreenProps> the engine’s RespawnScreen What covers the game while the player’s character waits to come back after its health ran out: the engine’s RespawnScreen, with the seconds left; a component of the game’s own; or nothing, with false. The CharacterSpawn’s respawn sets the wait.
room? false | RoomOptions undefined The room to play in: the world is then the room’s, streamed to this client, and only the player’s own character steps here. The engine draws the stream, the player’s own character among it. None plays alone. The page’s address goes over it, field by field: ?room= as the url, ?name= as the player’s name and ?wire=json as the wire, as spawnite play start and join write them, and in the app’s frame the seat the app took replaces the url, the ticket and the name. false keeps this world local whatever the address says, for a second Game on a page that joins a room, such as a model preview beside it. Read once, when Game makes its world.
sceneChangeScreen? false | LoadingScreenPick the game’s loadingScreen What covers the game from a change to another scene until the new scene’s first playable frame: the engine’s loading screen, dressed with the game’s options; a component of the game’s own, such as a fade; or nothing, with false. Whichever it is, the scene’s draws hold while a shader links, so the page keeps answering rather than stalling on the new scene’s first frames; with false the canvas shows the scene’s background meanwhile, and useLoading’s isChanging says when the change is in. A restart of the active scene is no change. The game’s sounds hold while a screen covers it.
shadows? false | "basic" | "percentage" | "variance" | "tent" | ShadowType ShadowType.Percentage How the shadow map filters a shadow’s edge, false for no shadow map at all, so no light casts one. Read once, when Game mounts.
warmUpMilliseconds? number 6000 The milliseconds the warm-up under the loading screen may run. Once the start scene has mounted, it draws the HUD the scene holds and one of each of the engine’s own effects, then each WarmHud in the order they mounted, out of sight, so the browser builds their GPU programs before play rather than in a stalled frame of it. A WarmHud the budget does not reach builds on first use. It runs beside the load, so not all of its time is added to it: on Holdfast it drew in about 2 s and lifted the screen about 1.2 s later on a first visit, and no later on a return visit. The order in the tree is the priority. 0 turns it off.