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

DevtoolsState

Property Type Description
addBehaviour (id, name) => void Adds a registered behaviour’s trait with its defaults, and a row for it under the entity’s, which goes when the trait does.
aimCamera (aim) => Pick<EngineCamera, "yaw" | "pitch"> Turns the player’s camera, at once: to a yaw and a pitch in degrees, as the engine’s state reads them, or by turn degrees of yaw from where it looks, and returns where it looks then. The camera’s own stops hold the pitch. Throws with no camera mounted.
attachToChat (id) => void Puts the row on the next chat message; once, however often called.
behaviourOptions (id) => BehaviourOption[] The registered behaviours the entity has not got.
capture (view, options?) => string | undefined A PNG data URL of the scene from a bookmarked camera, or undefined headless where no view is attached. The screen overlays the player’s view draws, such as a hurt vignette, stay out unless overlays is true.
captureScreen (options?) => string | undefined A PNG data URL of what the player sees, with nothing the page draws over the canvas, or undefined headless where no view is attached. Its screen overlays stay in unless overlays is false.
chatAttachments string[] The rows attachToChat put on the next chat message, in the order added.
clearChatAttachments () => void -
clearLog () => void -
compileRead (expression) => (scope) => unknown A read of the scope from an expression, as a browser’s console reads one. Throws on one that does not parse.
deleteEntity (id) => void Destroys the entity; its component takes its row down.
describe (id, options?) => EntityDescription An entity’s row, its behaviours, the systems that touch it, its relations, its traits and a screenshot framed on it, by the row’s id, else by the entity’s dump key, as a wiki entry’s usedBy holds it, else by its name where one entity row has it. A scattered instance’s id gives its placement instead. Throws naming the ids where several rows have the name, and on an id that is no entity’s or instance’s.
detachFromChat (id) => void -
dump () => StateDump The bound world as JSON.
editing boolean Edit mode, which is when the recording runs.
endMapFlight () => void The map camera’s word that the flight has settled, or was never flown.
findEntities (subject) => string[] The dump keys of the living entities subject names, as a shot’s subject names one: its key; a selector such as [monster.kind=colossus], a trait the dump names or a field of it with a value, as CSS’s attribute selectors read; or its row’s name in the tree. Empty where it names none; throws on a selector it cannot read.
focusCamera (id) => void Flies the orbit to the entity, at the distance that fits it, and stops the camera following until edit mode ends.
frameShot (camera, aspect) => MapView The camera a shot looks through on the mounted map: a raw view as written, or one framed round its subject from its angle, at the aspect given. With no map mounted, all frames what the scene draws. Throws on a subject the map has not got.
frameSplit FrameSplit | null The last 60 frames, written twice a second while frameTiming is on.
frameTiming boolean The loop times each frame into frameSplit; on while the overlay is mounted.
frameView (name) => MapView The camera for a name on the mounted map: a views entry, a region, a path, or map for the whole ground from above. Throws on a name the map has not got, and before a World has mounted.
freeCamera boolean The scene’s camera gives way to FreeCamera, and the player’s character stands still, as Unreal’s eject does.
goScene (name) => void Makes the scene of that registered name the one Game draws, as a playtest opens a scene past the start. Throws on a name no Scene registered.
hiddenIds string[] The rows whose entity hide took off the screen.
hide (id) => void Takes the entity off the screen; its physics and behaviours run on.
holdDeclared (name, value?) => DeclaredInputReply Holds a declared button or page action as its key holds it, or an axis at value, until releaseDeclared lets it go.
hover (id) => void -
hoveredId string | null The row under the pointer.
isLoading () => boolean Whether three’s loaders have a file in flight now, or a scene boundary has not drawn its content yet. The files are read from drei’s progress store, which the loading manager sets as a file starts, rather than the loading store the loop sets a frame later.
log LogLine[] The last two hundred lines the page’s console received, while captureLog is installed.
mapCamera boolean The scene’s camera gives way to MapCamera, the city builder’s camera over the map; never on with freeCamera.
mapFlight boolean The map camera, once mounted, flies up over the player’s character until the whole map is in view, then clears this.
mapFlightZoom number How much closer than the whole map’s frame the flight lands, as frameShot reads a zoom.
outline () => string The tree with the props left out: one row per line, indented under its parent, the entity id beside the name.
panels DevtoolsPanel[] -
pause () => void Does nothing on a room’s replica, which the room keeps running.
paused boolean Held still by the debugger; a modal’s pause is the modal stack’s.
pendingFrames number Fixed steps the loop still owes while paused: the period key.
pin (id) => void Pins the row, once however often called.
pinnedIds string[] The rows whose panel stands over their entity in the world, in the order pinned. Kept through a hot reload, which runs the game’s modules again but not this store’s, and gone on a page load; a row that leaves the tree drops its pin.
playFromHere (point) => void Stands the player’s character at point, [x, y, z], a spot of the ground as the ground’s menu reads it, facing as the camera faces, then leaves edit mode and plays, as Unreal’s Play From Here does.
pressDeclared (name, payload?) => DeclaredInputReply Presses what the game declares under name once, as its key would: a press or a command sent with payload, or a button or a page action tapped. spawnite play press dash.press.
previewPlayer { facing: number; position: [number, number, number]; } | null Where Play from here stands the player in a map preview, which has none of its own until then: the preview spawns the game’s player there, facing facing, a yaw in radians.
readAim () => AimReading Where the crosshair points now, and each shot the page sent its room with where the crosshair pointed then. Throws headless.
readAiTree (subjectId?) => AiNode[] The bound world in words, for the player, or for the entity of the row with subjectId: each described entity’s node, named as its row is. Built when read, since the words change every step.
readDisabledActions (id) => DisabledActions Why each of the actions below is off for the row, which is also what the action throws when called anyway.
readFrameSplit () => FrameSplit | null The last 60 frames as they stand, for a caller that cannot wait for frameSplit’s next write; none while nothing times them.
readMapFlight (eye, aspect) => Readonly<{ eye: readonly [number, number, number]; fov: number; ortho?: number; target: readonly [number, number, number]; }> | undefined The pose the flight ends in: the whole map from above at the aspect, on the side of the map the eye stands now, so the eye rises rather than crossing. Undefined where nothing is mounted to frame.
readPalette () => MapPalette What a creator can place, with how many of each stand now.
readPendingLoads () => PendingLoad[] Each file in flight and each scene boundary not yet drawn, with how long it has waited, so a wait that gives up can name it.
readPlayFromHereReason () => string | undefined Why playFromHere is off, which is also what it throws, or undefined where it is on.
readProfile () => SystemTime[] The bound world’s step by system, as readStepProfile reads it; none while profiling is off.
readScene () => string | null The scene Game draws now, by its registered name; null before any.
readScope (extras?) => PlayScope The scope a read of the page sees, as spawnite play eval, a step’s condition and a sample read it: the world as a dump files it, the engine’s state, the live world and scene, the game’s modules, what the camera sees and aims at, and the director’s input and time.
readStatFields (id) => Record<string, string> The props of the behaviour row id that a stat of its entity sets each step, each by that stat’s name: an edit of one lasts a step. registerStatField declares them.
readStats (frames?) => Promise<RenderStats | undefined> What the page costs to draw, over frames drawn frames, 60 unless given; undefined headless where no view is attached.
readViews () => Record<string, Record<string, unknown>> What each view exposes of its own state through useInspect, by the key a dump files its entity under, or page, then by name.
recordedFrames number Frames in the recording, so a scrubber redraws as it grows. Ten seconds of simulated time, however many frames drew them.
recordSent (message) => void -
registerPanel (panel) => Disposer The return forgets the panel.
registerWikiKind (kind) => Disposer Adds a kind of wiki entry beside the engine’s, such as a game’s quest or card. A kind registered again under its name replaces the first, since a hot reload runs the module again. The return forgets it, and puts back the engine’s kind of its name.
releaseDeclared (names) => DeclaredReleaseReply Lets go of each declared input names the tools hold, or of all of them where names is empty.
resetProps (id) => void Drops the row’s edits and writes the component’s props back, to the room too where setProp sent it the edits.
resume () => void -
screenRects Record<string, ScreenRect> Where the hovered and the selected entity, or HUD row’s element, stand on the canvas, keyed by row id: the Frameloop’s, while editing.
see (subject?, options?) => Sighting[] What the player’s camera sees of each entity a subject picks, or of every entity it draws: its pixels with the scene in front and with nothing in front, and the box they fill. Throws headless.
seek (frame) => RecordedFrame | undefined The recorded frame frame back from the newest, where 0 is the oldest kept; the world stays where it is.
select (id) => void The row alone, or nothing.
selectedId string | null The primary of selectedIds, the one the inspector shows.
selectedIds string[] Every picked row, in the order picked, selectedId the last.
selectPlaceable (placeable, adding) => void Selects every row that draws the placeable, or adds them to the selection. A shape, or a placeable nothing draws, changes nothing.
sentMessages SentMessage[] Every message the page sent this session, oldest first: the pane’s and the chat’s share it.
setEditing (editing) => void Off drops the recording and gives the camera back the follow focusCamera stopped. The screen rects go either way: the loop writes them again while editing.
setFrameTiming (frameTiming) => void -
setFreeCamera (freeCamera) => void On, it takes the map camera’s place.
setMapCamera (mapCamera, zoom?) => void On, it takes the free camera’s place and asks the map camera to fly out over the map, landing at zoom of the whole map’s frame, as frameShot reads a zoom: the map camera’s own landing, 3, unless given.
setProfiling (profiling) => void Times the bound world’s step by system from its next step, or stops timing it.
setProp (edit) => void Writes one prop of a behaviour row onto the trait whose schema has the field, and records it under the row’s edits until the component passes that trait a changed prop. A number is clamped to the row’s declared range for it. An edit of an entity a room streams goes to the room too, where it takes edits. Throws on a row that is no behaviour’s or is read-only, a name that is none of its props or no trait’s field, a field a stat sets, a function, a number that is not finite, and a value of another type than the prop’s.
setSpeed (speed) => void Does nothing on a room’s replica, as pause does: the character’s moves follow the local steps, and the room applies them at its own rate.
setStatBase (edit) => void Sets a stat’s base on the entity the row stands for, as setStatBase does, so its modifiers still apply over it, and records it under the row’s statEdits until the component that declared the stat declares it anew. Throws on a stat the entity has not got, a base that is not finite, and an entity a room streams, whose room keeps its stats.
setTraits (subject, traits) => string[] Writes traits, each by the name a dump files it under and in the shape a dump writes it, onto every living entity subject names, as findEntities reads it, and returns their keys: spawnite play set on a game with no room. Throws where no entity answers.
setWorldPanels (worldPanels) => void -
show (id) => void -
speed number A multiplier on each frame’s time: 0.25, 1 or 2 on the top bar.
startSample (read) => () => FrameSample<unknown>[] Reads an expression, or a function of the scope, after each frame the page draws; the call it returns stops and answers each frame’s value.
step (seconds) => void Advances the bound world by seconds of fixed steps on its last input, with no clock: an agent’s call, never a control in the overlay.
stepFrame () => void Pauses a running world and owes it one fixed step, which whoever runs the world takes: the Frameloop in the browser, driveDevtools headless. A headless world with neither steps nothing on this call, so a test advances it with step(seconds). Does nothing on a room’s replica, as pause does.
stepUntil (options) => Promise<UntilResult> Pauses the world, then takes one fixed step at a time until the expression holds or the steps run out, leaving it paused on that step. The condition sees entities, count(trait), has(id, trait), player() and steps; one that throws counts as not yet. Whoever runs the world takes each step: the Frameloop in the browser, driveDevtools headless. Throws on a room’s replica, which cannot pause.
toggleSelect (id) => void Adds the row to the selection, or takes it out where it is in.
tree DevtoolsNode[] The scene as the developer wrote it: no invented groups.
unpin (id) => void -
walkTo (options) => Promise<WalkResult> Sends the player’s character walking to a point along the navmesh, as a click on the ground does, then steps as stepUntil does until she stands at the route’s end, which is as near the point as a route reaches. Throws where the point is off the navmesh.
wiki () => Wiki Every registered kind, the engine’s then a game’s, and the entries each finds in the bound world: what each part of the game is, what it belongs to, what it refers to and which entities carry it. A kind whose list throws lists nothing, and a repeated kind:name keeps its first entry; each warns.
worldPanels boolean The overlay draws a pinned row’s panel in the world, and its frame offers Pin; off, the pins stay and nothing draws them.