Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions content/user/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ This reference was checked against engine commit `017db99b7025eeda96acf219676641
| --- | --- | --- | --- |
| Lua 5.4 (.lua) | Bundled embedded Lua | Implemented; immediate core host writes, new instance ID returned | Recording, hot mic and reusable loading implemented |
| Luau (.luau) | Engine-provided external host | Implemented; SDK command/query boundary | Recording, hot mic and reusable loading implemented |
| JavaScript (.js) | Bundled QuickJS | Implemented; deferred core writes, synchronous queries | Capture and reusable loading unsupported |
| Python (.py) | Python toolchain | Implemented via SDK | Capture and reusable loading unsupported |
| C (.c) | C17 compiler | Implemented via SDK; explicit callback/storage conventions | Capture and reusable loading unsupported |
| C++ (.cpp) | C++ toolchain | Implemented via typed SDK | Capture and reusable loading unsupported |
| C# (.cs) | .NET SDK | Implemented via SDK | Capture and reusable loading unsupported |
| Java (.java) | java and javac | Implemented via SDK | Capture and reusable loading unsupported |
| PHP (.php in ui/) | PHP CLI | Implemented via SDK | Capture and reusable loading unsupported |
| HTML/inline JS (.html in ui/) | QuickJS extraction, no browser | Implemented JavaScript behavior surface; CSS-only is a no-op | Capture and reusable loading unsupported |
| JavaScript (.js) | Bundled QuickJS | Implemented; deferred core writes, synchronous queries | Recording, hot mic and reusable loading implemented |
| Python (.py) | Python toolchain | Implemented via SDK | Recording, hot mic and reusable loading implemented |
| C (.c) | C17 compiler | Implemented via SDK; explicit callback/storage conventions | Recording, hot mic and reusable loading implemented |
| C++ (.cpp) | C++ toolchain | Implemented via typed SDK | Recording, hot mic and reusable loading implemented |
| C# (.cs) | .NET SDK | Implemented via SDK | Recording, hot mic and reusable loading implemented |
| Java (.java) | java and javac | Implemented via SDK | Recording, hot mic and reusable loading implemented |
| PHP (.php in ui/) | PHP CLI | Implemented via SDK | Recording, hot mic and reusable loading implemented |
| HTML/inline JS (.html in ui/) | QuickJS extraction, no browser | Implemented JavaScript behavior surface; CSS-only is a no-op | Recording, hot mic and reusable loading implemented |

### Method-specific differences

- `rustic.find_entity` and object-path `GetAttribute` convenience calls are embedded Lua-specific in the published reference. Prefer each language’s scene lookup guide; general scene lookup support does not imply identical helper names.
- `Clock.state` is exposed in embedded Lua/JavaScript, Luau and Python; other SDKs provide setter controls. C#/PHP additionally expose a scale getter. See [Clock](/docs/api/clock).
- Every gameplay binding exposes live rustic.find_entity and object attribute reads. Use rustic.get_object_attribute(source, name), or the path proxy getter. Native spellings differ.
- Clock.state is available in every gameplay language; native return types follow their SDK.
- Audio device enumeration/selection exists in all ten script types but native devices require Windows. Non-Windows enumeration returns empty lists; device selection raises an error. Microphone capture requires Windows permissions and uses the system default input, independently of selected input-device metadata.
- Lua/Luau game-output recording can run headlessly; microphone recording and hot mic require Windows. Recording captures audio, not video. Read and unload capture handles before owner cleanup; see [Audio recording](/docs/api/audio/start-recording).
- Game-output recording in every gameplay language can run headlessly; microphone recording and hot mic require Windows. Recording captures audio, not video. Read and unload capture handles before owner cleanup; see [Audio recording](/docs/api/audio/start-recording).
- Collision callback names are not evidence of event delivery: no collision/touch callbacks are emitted by the primitive simulator.

## Platform compatibility
Expand Down
6 changes: 4 additions & 2 deletions content/user/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Lua and JavaScript also accept compatible snake-case spellings; canonical names
| Runtime / operation | Execution behavior |
| --- | --- |
| Embedded Lua 5.4 core writes | Host methods update the Play world immediately, including translation, attributes and properties. `instance.add/clone` return the new stable ID immediately. |
| Embedded JavaScript / Web core writes | Translation, property/attribute writes, enabled state, camera selection, logging and instance creation are collected and applied in order after a successful callback. Reads use the callback snapshot; creation returns no new entity ID. A canonical scene-object API call can flush these commands before resolving its target. |
| Embedded JavaScript / Web core writes | Translation, property/attribute writes, enabled state, camera selection, logging and instance creation are collected and applied in order after a successful callback. Owner getters use the callback snapshot; a synchronous query first flushes earlier writes. Creation returns no new entity ID. Canonical scene-object API calls flush earlier writes before resolving the live target path. |
| External SDKs: Python, C, C++, C#, Luau, Java, PHP | Core commands normally commit with the callback response. A synchronous query flushes earlier commands in order before evaluating the query. Simple snapshot getters still use lifecycle state, so flushing does not refresh that snapshot. |
| Synchronous gameplay queries | Evaluate when called. Examples include physics queries/impulses, environment updates and audio controls. Embedded JavaScript queries normally do not flush earlier queued core writes. Canonical `game.scene.Scene.Object` target resolution flushes earlier commands before resolving the live path; this also applies to HTML inline JavaScript. |
| Synchronous gameplay queries | Evaluate when called. Examples include physics queries/impulses, environment updates and audio controls. Embedded JavaScript and external SDK queries flush earlier queued core writes before evaluation. Owner snapshot getters do not refresh their snapshot. Canonical game.scene.Scene.Object target resolution also flushes earlier commands before live path lookup, including HTML inline JavaScript. |
| Scheduled actions / events | Actions are registered and advanced by the shared scene clock. Events/completion callbacks are delivered through the scheduler, not by a direct call into another script’s VM. |

These distinctions describe the current adapters, not a transaction guarantee. In particular a Lua write already applied before a later error is not automatically rolled back. Keep order-sensitive operations explicit and avoid assuming a later getter sees a deferred write. API 1.1 is the gameplay API capability version; it is unrelated to Docs v0.1.
Expand All @@ -58,3 +58,5 @@ Inspect Console diagnostics and click source locations to open the external edit
Lua/QuickJS are isolated embedded runtimes. External languages use persistent child sessions and engine-supplied SDKs; do not print protocol data or invent a network service. There are source/response bounds and callback timeouts. Per-instance runtimes/processes, synchronous queries and frequent logs have costs; this documentation makes no benchmark claims. Use engine-scheduled actions for time-based work and avoid per-frame log flooding. See [Runtime architecture](/docs/open-source/engine/scripting-architecture) and [Sandbox and Play safety](/docs/guides/gameplay-programming/sandbox-and-play-safety).

Optional AI/MCP workflows live in [Advanced agent integration](/docs/guides/ai-agents); they are not prerequisites for making a game.

See [APIs in every language](/docs/guides/api-languages) for the shared API families, loaded audio, capture handles and live object reads.
2 changes: 1 addition & 1 deletion content/user/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Read-only projects may have another active editor holding the lock or a future u

## Audio and platform differences

Native playback/devices and microphone input require Windows in this implementation. Game-output recording works headlessly in Lua/Luau; hot mic does not. Denied microphone access, absent devices, stale device IDs and unsupported formats can raise script errors. The selected input device does not redirect Lua/Luau capture from the system default. See [Audio](/docs/api/audio) and [Compatibility](/docs/reference/compatibility).
Native playback/devices and microphone input require Windows in this implementation. Game-output recording works headlessly in every gameplay language; hot mic does not. Denied microphone access, absent devices, stale device IDs and unsupported formats can raise script errors. The selected input device does not redirect capture from the system default. See [Audio](/docs/api/audio) and [Compatibility](/docs/reference/compatibility).

## Reporting a problem

Expand Down
22 changes: 14 additions & 8 deletions docs/Scripting/API/audio.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The signatures and complete example below use JavaScript. Attach a JavaScript Ob
| OGG Opus | `.ogg`, `.oga`, `.opus` | Mono or stereo Opus (mapping family 0) |

Put the file inside your project's `assets/` folder. Extensions are case
insensitive. The same formats work with loaded Lua/Luau audio handles and
insensitive. The same formats work with loaded audio handles in every gameplay language and
`Audio.play` / `Audio.playAt` in every supported script language. For example,
`rustic.game.assets.music["theme.mp3"]:load()` or
`Audio.play("assets/music/theme.flac")` uses the usual audio controls.
Expand All @@ -38,7 +38,7 @@ bytes and 200 million decoded samples per clip. Opus decodes at 48 kHz and
respects header gain, encoder delay, and end padding; other formats preserve the
decoded sample rate. Lossy decoder peaks are clamped to the mixer's [-1, 1] range.

## Load and control audio objects (Lua and Luau)
## Load and control audio objects

Create `assets/sounds/` in your project and place `crash.wav` there (WAV, MP3, AAC, FLAC, and OGG are supported). Create a Lua or Luau Object Component script, attach it to an
enabled scene object, and press **Play**. Use `Start` to load audio before playing:
Expand Down Expand Up @@ -87,7 +87,10 @@ with no active playback are harmless.
error. Missing, unsupported, or invalid files fail during `load()`. Check the
Console, attachment, file name and extension. Paths must stay inside `assets/`.

The object methods and `Audio.load` are available in Lua 5.4 and Luau. Existing
Audio.load and loaded playback/control/unload are available in every gameplay language.
Asset path proxies retain their Lua/Luau syntax and are also available in JavaScript;
other languages use Audio.load(source). See [APIs in every language](/docs/guides/api-languages)
for native signatures and examples. Existing
`Audio.play(source, options?)` and `Audio.playAt` in all languages still decode
and play immediately; their voice controls continue to work.

Expand All @@ -105,7 +108,7 @@ list and report an unavailable-backend error when selecting a device.
- `Audio.set_output_device(id)` switches this scene's mixed audio to that output.
- `Audio.set_input_device(id)` validates and retains the scene's selected input
device. This call does not start capture or route microphone sound to playback.
Lua/Luau recording and hot mic capture currently use the system default input
Recording and hot mic capture currently use the system default input
independently of this selection; see the recording section below.
- Pass `null` (Lua/Luau `nil`, Python `None`, C `NULL`) to either setter to select
the current system default. Java requires an explicit `null` argument; other
Expand Down Expand Up @@ -156,7 +159,7 @@ plugging/unplugging hardware. Empty lists are valid on hosts without devices.

- `Audio.get_output_devices() / get_input_devices()`
- `Audio.set_output_device(id = null) / set_input_device(id = null)`
- `Audio.load(source)` (Lua/Luau; returns a reusable audio handle)
- `Audio.load(source)` (every gameplay language; returns a reusable audio handle)
- `Audio.play(source, options?)`
- `Audio.playAt(source, position, options?)`
- `voice.pause() / resume() / stop()`
Expand Down Expand Up @@ -200,11 +203,14 @@ globalThis.behavior = {
- Check script attachment, enabled state and the Console when an operation fails. Asynchronous errors also appear in operation state. Callback exceptions disable the owner and clean up its actions.
- Owner destruction, disable, successful reload or Stop cleans up owned actions and subscriptions. Failed reload retains the previous behavior's operations. See [Operation handles](/docs/api/operation-handles) for controls and lifetime details.

## Record audio and read a hot microphone (Lua and Luau)
## Record audio and read a hot microphone

Create a Lua or Luau Object Component script in `scripts/`, attach it to an
**enabled** scene object, and press **Play**. Start capture inside `Start` or
another callback. Capture methods use camel case and colon syntax:
another callback. The example below uses Lua/Luau colon syntax. All gameplay languages expose
Game.startRecording, stopRecording, startHotMic, stopHotMic and capture
handle read/stop/unload; see [APIs in every language](/docs/guides/api-languages)
for copyable native bindings:

```lua
local rec
Expand Down Expand Up @@ -299,5 +305,5 @@ return {
and OS microphone access. Default F32, I16 and U16 device formats are supported.
Missing devices, permission failures, unsupported formats, startup timeouts and
device disconnection raise errors. Game mixer recording works headlessly too.
- These convenience bindings are available in Lua 5.4 and Luau. Hot mic supplies
- These services are available in every gameplay language. Hot mic supplies
local PCM; automatic network transport and speaker monitoring are not provided.
2 changes: 1 addition & 1 deletion docs/Scripting/API/camera-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ globalThis.behavior = {

- Create/select an active perspective camera before Play. It reaches the given position, identity rotation and 45-degree FOV in two seconds.
- Lua/Luau/JavaScript additionally allow moveTo(position, duration, easing) and zoom(fov, duration, easing) for the current camera. Explicit targets work across all bindings.
- C has no Camera.current helper: resolve an explicit camera ID. Other native bindings expose current.
- Camera.current is available in every gameplay language, including C; it returns the active camera ID.
- LookAt samples when starting; follow re-reads its target only during the finite duration. Orbit uses local XZ. Shake restores its initial position.
- Check script attachment, enabled state and the Console when an operation fails. Asynchronous errors also appear in operation state. Callback exceptions disable the owner and clean up its actions.
- Owner destruction, disable, successful reload or Stop cleans up owned actions and subscriptions. Failed reload retains the previous behavior's operations. See [Operation handles](/docs/api/operation-handles) for controls and lifetime details.
2 changes: 1 addition & 1 deletion docs/Scripting/API/clock.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The Calls section uses JavaScript signatures. The function examples below includ

## Parameters

Scale is finite non-negative; 1 is normal rate and 0.5 is half speed. JavaScript state returns the current scale and paused flag. Native getter/state availability varies; C/C++/Java timeScale requires a value.
Scale is finite non-negative; 1 is normal rate and 0.5 is half speed. Clock.state() returns the current scale and paused flag in every gameplay language. C returns RusticClockState; C++ returns RusticValue; C# returns JsonElement; Java returns a map. C sets time scale with Clock.timeScale(value) and reads it with Clock.state().scale.

## Return and timing

Expand Down
2 changes: 2 additions & 0 deletions docs/Scripting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ object using `rustic.game.<scene-name>.<hierarchy>` in native language syntax.

See [Entity foundations](API/entity-foundations.md) for live tags, groups, hierarchy,
lifetime, component and world queries in the shared scripting runtime.

See [APIs in every language](/docs/guides/api-languages) for the shared API families, reusable audio, capture, and live object reads.
Loading
Loading