<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Constants Re exports , , , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Constants — 3D Noise Functions for Volumetric Effects Used for smoke turbulence, wispy distortion, and organic blending <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Constants — SDF Shape Library Signed Distance Field functions for volumetric particle rendering. Based on Inigo Quilez's distance functions: https://iquilezles.org/articles/distfunctions/ <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Particle Thermal/Blackbody Debug Pass Visualizes particle temperature as blackbody radiation color. Cold (blue) → Room temp (invisible) → Hot (red/orange/white). Requires uThermalData buffer (binding 4) for per particle temperature. Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Scene Debug Visualizer Shader Fullscreen post process that reads the ACTUAL scene depth buffer (texture depth 2d) containing both entity meshes and particles, and visualizes: Mode 0: Depth — linearized grayscale (near=white, far=black, industry standard) Mode 1: Normals — world space normals reconstructed from depth (RGB = XYZ) Mode 2: Albedo — passthrough of scene color (placeholder) Mode 3: Lighting — scene luminance only Reads from texture depth 2d (depth24plus) — NOT texture 2d<f32 . Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


render/shaders/modules/postfx/bloom.js
Constants
Notes & Examples
Shared GPU device


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Ray Portal WGSL Shader Module Provides WGSL functions for all proxy geometry quality tiers: ULTRA — TLAS/BLAS two level BVH traversal with ray redirect HIGH — SDF cone marching proxy MED — True impostor (billboarded SDF/height field) LOW — Octahedral impostor atlas sampling All functions are pure WGSL and intended to be embedded via template literals into compute shader source strings. Constants — Ray Portal WGSL Shader Module Provides WGSL functions for all proxy geometry quality tiers: ULTRA — TLAS/BLAS two level BVH traversal with ray redirect HIGH — SDF cone marching proxy MED — True impostor (billboarded SDF/height field) LOW — Octahedral impostor atlas sampling All functions are pure WGSL and intended to be embedded via template literals into compute shader source strings. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap


Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


render/spectral/SpectralPhotonMapper.js
Classes
class SpectralPhotonMapper
Functions
createSpectralPhotonMapper(options)
Notes & Examples
Shared GPU device


render/spectral/SpectralPhotonStore.js
Classes
class SpectralPhotonStore
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


sellmeierIor(lambdaNm, coefficients = null)

prismMinimumDeviation(lambdaNm, apexRadians = Math.PI / 3, coefficients = null)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


spectralSamplesToDisplayRgb(samples, exposure = 1)


createWavelengthPacket(lambda, pdf, activeMask = 1, hero = 0)

createPhotonPacket(position, direction, lambdaNm, flux, flags = 0, normal = null)

createVisiblePoint(position, normal, materialId = 0, radius = SPECTRALDEFAULTS.photonRadius)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createConstantSpectrum(value = 1, scale = 1)

createTabulatedSpectrum(samples, scale = 1)

createBlackbodySpectrum(temperatureK = 6500, scale = 1)


wavelengthToBand(lambdaNm, bandCount = 18, minNm = SPECTRALRANGE.minNm, maxNm = SPECTRALRANGE.maxNm)

bandCenterWavelength(band, bandCount = 18, minNm = SPECTRALRANGE.minNm, maxNm = SPECTRALRANGE.maxNm)

sampleVisibleWavelength(u = uniformDistribution(0, 1, Math.random)

sampleStratifiedVisiblePacket(seed = 1, count = 4)

samplePhotonWavelength(lightSpectrum, seed = 1, bandCount = 18)


render/spectral/index.js
Exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Exports No ES module exports detected in this file. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Typed, read only adapter from the authoritative ECS Transform + Renderable archetypes to the State First presentation source protocol. ECS continues to own identity and transform/renderable state. Presentation owns mesh bounds, importance, dirty state, and the currently materialized representation through explicit resolver callbacks. The adapter retains no entity records and applies policy only through . Classes Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Backend neutral execution policy for State First simulations. This object owns selection, frame boundary switching, and measured reports. It deliberately does not own a CPU step function or GPU shader so the same contract can be shared by every State First simulation. Classes Method Signature Summary Functions Constants — Backend neutral execution policy for State First simulations. This object owns selection, frame boundary switching, and measured reports. It deliberately does not own a CPU step function or GPU shader so the same contract can be shared by every State First simulation. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


chooseStateFirstRepresentation(pixelRadius, importance = 0, current = STATEFIRSTREPRESENTATION.POINT, holdFrames = 0, thresholds = DEFAULTTHRESHOLDS, policy = null, lodRank = 0.5)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Retained state backing for state first renderers. Entity state lives at a stable entity id derived offset while each visual representation owns a dense u32 indirection bucket. Representation changes therefore never move authoritative state, and an entity may participate in two buckets while an LOD cross fade is in progress. Classes Method Signature Summary Functions Constants — Retained state backing for state first renderers. Entity state lives at a stable entity id derived offset while each visual representation owns a dense u32 indirection bucket. Representation changes therefore never move authoritative state, and an entity may participate in two buckets while an LOD cross fade is in progress. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large


this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Explicit runtime bridge between authoritative simulation state and the State First presentation policy. The bridge deliberately does not guess GPU layouts or invent renderable entities from arbitrary objects. A source must publish the V1 protocol, provide semantic presentation entities, and consume the resulting plan. GPU sources additionally prove that their active byte range fits in the authoritative GPUBuffer on every update, which makes ping pong buffers and capacity growth safe to expose without readback. Classes Method Signature Summary Functions Constants — Explicit runtime bridge between authoritative simulation state and the State First presentation policy. The bridge deliberately does not guess GPU layouts or invent renderable entities from arbitrary objects. A source must publish the V1 protocol, provide semantic presentation entities, and consume the resulting plan. GPU sources additionally prove that their active byte range fits in the authoritative GPUBuffer on every update, which makes ping pong buffers and capacity growth safe to expose without readback. <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks


it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


render/state/index.js
Re-exports
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Re exports , , , , , , , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Virtual Texturing System On demand texture streaming Megatexture/Sparse Virtual Texture implementation Used for massive open worlds with unlimited texture detail Now powered by vGPU driver Classes Method Signature Summary Sample virtual texture in shader Returns shader code for virtual texture sampling Record feedback readback and clearing into the host owned encoder. No queue submission or mapping happens here. Notify the ring after the host has submitted the command buffer. Consume completed feedback without awaiting a GPU map or page fetch. Compatibility wrapper for callers that still own a self contained job. Clear IndexedDB cache Prefetch pages for a region (call during loading screens) <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations.


reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


render/volumes/HybridVolumeSystem.js
Classes
class HybridVolumeSystem
Constants
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Initialize GPU resources Set particle buffers for splatting Bridge a mesh to use as particles Mesh vertices become particle positions Remove a mesh bridge Mark a region as dirty (needs update) Mark entire volume as dirty Update volume bounds to follow camera (Frostbite/UE style froxel approach) Centers volume around camera position with configurable range Update the volume grid from particle data Get current density buffer for rendering Get current color buffer for rendering Get volume bounds Set volume bounds Set render mode Get render mode Update configuration Get statistics Cleanup Constants <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the


primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


async createParticleVolumeConnector(device, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Initialize the volume system Connect a particle renderer Automatically detects buffer names Manually set buffer accessors for a renderer Disconnect a renderer Update the volume system with current particle data Set scene textures for compositing Render the volume Set render mode Configure for smoke Configure for water Set volume bounds Enable/disable Get statistics Resize Cleanup Functions Quick factory to create a connector and initialize it <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


render/volumes/UnifiedVolumeRenderer.js
Classes
class UnifiedVolumeRenderer
Notes & Examples
Shared GPU device

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Set volume data from HybridVolumeSystem Set scene textures for compositing Update frame uniforms Render volume Set render mode Configure smoke rendering Configure water rendering Resize Cleanup <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


createVolumeIntegration(device, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Method Signature Summary Initialize both systems Connect an existing particle system The particle system should have: positionBuffer, metaBuffer, velocityBuffer, count Disconnect a particle system Add a mesh to be rendered as volumetric particles Remove a mesh Set volume bounds Auto fit volume bounds to particle positions Set render mode Configure for smoke rendering Configure for water rendering Enable debug density visualization Disable debug mode Update the volume system (call before render) Set scene textures for compositing Render the volume (call during render pass) Get statistics Enable/disable the volume system Toggle enabled state Resize Cleanup Functions Re exports <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap


Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


async createVolumetricSystem(device, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Quick factory to create a complete volumetric setup Parameters: (GPUDevice) — No description in source JSDoc. (Object) — No description in source JSDoc. Re exports , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples Shared GPU device Engine subsystems should reuse the cached wrapper returned by . The wrapper owns the native , its queue, granted features, limits, and device loss callbacks. Resources created by one native device cannot be used by another, so pass the shared wrapper or native device into each subsystem that needs GPU access. Example: Acquire the shared engine device Request a feature only when the application cannot run without it. automatically requests the engine's supported optional feature set, while reports the features actually granted to the device. Feature and limit checks Device loss Gotchas: First acquisition defines requirements: caches the wrapper. Supply mandatory features and limits on the first call. Native access: use and when a subsystem needs WebGPU primitives. Recovery: this module reports device loss but does not expose an in place API. Re bootstrap all device owned resources together. Limits: check the granted before large allocations. (Source: ) See also: GPU Device Sharing · Virtual GPU · GpuFormats


scenes/PhysicsSandboxScene.js

configurePhysicsSandboxScene(world, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions <! HUMAN NOTES Notes & Examples World Streaming & Scenes The world system manages scene graphs, asset streaming, and level transitions. Scenes are entity hierarchies with spatial indexing (BVH) for fast culling and raycasts. Worlds stream assets asynchronously with priority based on distance and visibility. Example: Scene graph and streaming See also: Engine Overview


sim/SimulationUpdate.js

stepFluid(smoke, particles, gpuDevice, delta, options = {})

stepAllSimulations(state, delta, entities, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Step the particle simulation (emission, colliders, physics). Parameters: (Object) — Particle state object (Object) — Configuration options (number) — Time delta (Array) — Spawned entities for collision (Function) — Function to get entity transform (Object) — Physics state { gravity, gravityScale } (number) — Half size of room for bounds (number) — Strength of particle coupling to fluid Returns: Updated particle state info Step the fluid simulation (density splatting, advection). Parameters: (Object) — Smoke/fluid state object (Object) — Particle state for emitter sources (Object) — GPU device wrapper (number) — Time delta (Object) — Additional options (number) — Minimum ms between splats (default 200) (number) — Warmup delay before splatting (default 2000) (Function) — Error callback (number) — Room bounds for clamping volume (number) — Approximate current FPS (number) — Minimum FPS for splats (default 0) (number) — Bounds smoothing factor [0,1] (default 0.2) (Object) — Optional debug logger (boolean) — Optional debug log sources (number) — Optional debug max sources (Array) — Optional precomputed fluid sources Returns: Whether fluid was stepped Step all simulations in one call. Parameters: (Object) — Combined state { particles, smoke, gpu, physics, config, ecs } (number) — Time delta (Array) — Spawned entities (Object) — Additional options <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics


sim/SimulationUpdate.js

provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


raySphereIntersect(rayOrigin, rayDir, sphereCenter, radius)

hasLineOfSight(from, to, obstacles, options = {})

hasLineOfSightSpheres(from, to, spheres, ignoreIds = [])

predictiveAim(shooterPos, projectileSpeed, targetPos, targetVel)

predictiveAimWithAcceleration(shooterPos, projectileSpeed, targetPos, targetVel, targetAccel, iterations = 4)

gaussianRandom(mean = 0, stdDev = 1, rng = null)

calculateThreatScore(npc, target, options = {})

selectTarget(npc, candidates, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create a ray with pre computed inverse direction for fast intersection tests Parameters: (number[]) — [x, y, z] ray origin (number[]) — [x, y, z] normalized direction Returns: Ray object with origin, direction, and invDir Ray AABB intersection using the slab method Used by NVIDIA OptiX and other professional engines Parameters: (Object) — Ray with origin, direction, invDir (number[]) — [x, y, z] minimum corner (number[]) — [x, y, z] maximum corner Returns: Distance to intersection, or 1 if no hit Ray sphere intersection using quadratic formula Good for character hitboxes and bounding spheres Parameters: (number[]) — [x, y, z] (number[]) — [x, y, z] normalized direction (number[]) — [x, y, z] (number) — Sphere radius Returns: Distance to intersection, or null if no hit Check line of sight between two points against obstacle list Parameters: (number[]) — [x, y, z] start position (number[]) — [x, y, z] end position (Object) — Optional settings (Function) — (x,y,z) = material ID for voxel terrain checks Returns: True if line of sight is clear Check line of sight with sphere obstacles (characters) Parameters: (number[]) — [x, y, z] (number[]) — [x, y, z] (number[]) — Entity IDs to ignore (self, target) Returns: True if clear Calculate aim point to intercept a moving target Solves: P + V×t ² = (S×t)² (quadratic intercept equation) Parameters: (number[]) — [x, y, z] shooter position (number) — Speed of projectile (m/s) (number[]) — [x, y, z] current target position (number[]) — [x, y, z] target velocity Returns: {aimPoint: [x,y,z], timeToHit: number} or null if impossible


(number[]) — [x, y, z] current target position (number[]) — [x, y, z] target velocity Returns: {aimPoint: [x,y,z], timeToHit: number} or null if impossible Iterative predictive aim for accelerating targets Parameters: (number[]) — [x, y, z] (number) — m/s (number[]) — [x, y, z] (number[]) — [x, y, z] (number[]) — [x, y, z] acceleration (number) — Number of refinement iterations (default 4) Returns: {aimPoint, timeToHit} or null Generate Gaussian distributed random number using Box Muller transform Parameters: (number) — Mean of distribution (default 0) (number) — Standard deviation (default 1) Returns: Gaussian distributed value Apply accuracy spread to aim direction (2D version) Parameters: (number[]) — [x, y] normalized 2D direction (number) — Spread angle in radians Returns: [x, y] spread direction Apply accuracy spread to aim direction (3D version) Generates a cone of spread around the aim direction Parameters: (number[]) — [x, y, z] normalized 3D direction (number) — Spread angle in radians Returns: [x, y, z] spread direction Calculate threat score for a potential target Parameters: (Object) — NPC data {position, recentDamageFrom, currentTarget} (Object) — Target data {id, position, dps, currentTarget} (Object) — Options {maxRange, maxDps, obstacles, weights} Returns: Threat score 0 1 Select best target from candidates with hysteresis Parameters: (Object) — NPC data (Array<Object ) — Potential targets (Object) — Scoring options Returns: Best target or null Create a target memory tracker for an NPC Remembers lost targets for a duration Returns: Target memory manager Update target memory with current perception Parameters: (Object) — Target memory object (Object null) — Currently visible target or null (number) — Current timestamp (ms) Get aim point considering


Parameters: (Object) — Target memory object (Object null) — Currently visible target or null (number) — Current timestamp (ms) Get aim point considering target memory Parameters: (Object) — Target memory (Object null) — Currently visible target (number) — Current timestamp (ms) Returns: Aim point [x, y, z] or null Calculate accuracy modifier based on combat conditions Parameters: (Object) — Combat parameters (number) — Distance to target (number) — Range at which accuracy starts degrading (number) — Shooter movement speed (number) — Target movement speed (number) — Accumulated recoil from sustained fire (degrees) (number) — Recoil recovery rate (degrees/second) (number) — Time since last shot (seconds) Returns


updateAIAimingSystem(system, deltaTimeMs, potentialTargets, obstacles)

npcFireWeapon(system, npc, targets, obstacles)

decayDamageMemory(npc, deltaTimeMs, decayRate = 10)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create an NPC combat controller Parameters: (Object) — NPC configuration Returns: NPC combat controller Initialize weapons for an NPC Parameters: (Object) — NPC combat controller Initialize melee for an NPC Parameters: (Object) — NPC combat controller (Object) — Melee configuration Create the main AI aiming system Parameters: (Object) — System configuration Returns: AI aiming system Register an NPC with the aiming system Parameters: (Object) — AI aiming system (Object) — NPC combat controller Unregister an NPC from the aiming system Parameters: (Object) — AI aiming system (number) — NPC ID Update player position for LOD calculations Parameters: (Object) — AI aiming system (number[]) — [x, y, z] player position Main update function for the AI aiming system Parameters: (Object) — AI aiming system (number) — Delta time in milliseconds (Array<Object ) — All potential targets {id, position, velocity, team, dps} (Array<Object ) — Obstacle AABBs {min, max} Command NPC to fire current weapon Parameters: (Object) — AI aiming system (Object) — NPC combat controller (Array<Object ) — Target colliders (Array<Object ) — Obstacle colliders Returns: Fire result or null Command NPC to perform melee attack Parameters: (Object) — NPC combat controller (Array<Object ) — Nearby targets Returns: Hit results Apply damage to NPC Parameters: (Object) — NPC combat controller (number) — Damage amount (number) — Attacker ID Decay recent damage memory over time Parameters: (Object) — NPC combat controller (number) — Delta time in ms (number) — Decay per second (default 10) Get all rays for GPU


damage memory over time Parameters: (Object) — NPC combat controller (number) — Delta time in ms (number) — Decay per second (default 10) Get all rays for GPU batch processing Parameters: (Object) — AI aiming system Returns: } Ray data Apply batch ray results from GPU Parameters: (Object) — AI aiming system Constants — NPC combat states — LOD update frequencies (frame intervals) Re exports , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


createParallel(name, children = [], successThreshold = -1, failureThreshold = 1)

createRandomSelector(name, children = [])

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create a Selector node (OR logic) Runs children left to right, succeeds if ANY child succeeds Parameters: (string) — Node name (Array<Object ) — Child nodes Returns: Selector node Create a Sequence node (AND logic) Runs children left to right, fails if ANY child fails Parameters: (string) — Node name (Array<Object ) — Child nodes Returns: Sequence node Create a Parallel node Runs all children simultaneously Parameters: (string) — Node name (Array<Object ) — Child nodes (number) — Number of successes needed (default: all) (number) — Number of failures to fail (default: 1) Returns: Parallel node Create a Random Selector (picks random child) Parameters: (string) — Node name (Array<Object ) — Child nodes Returns: Random selector node Create an Inverter decorator Inverts child result: SUCCESS ↔ FAILURE Parameters: (string) — Node name (Object) — Child node Returns: Inverter node Create a Repeater decorator Repeats child N times or until failure Parameters: (string) — Node name (Object) — Child node (number) — Times to repeat ( 1 for infinite) Returns: Repeater node Create an UntilFail decorator Repeats child until it fails Parameters: (string) — Node name (Object) — Child node Returns: UntilFail node Create an UntilSuccess decorator Repeats child until it succeeds Parameters: (string) — Node name (Object) — Child node Returns: UntilSuccess node Create a Succeeder decorator Always returns SUCCESS Parameters: (string) — Node name (Object) — Child node Returns: Succeeder node Create a Failer decorator Always returns FAILURE Parameters: (string) — Node name (Object) — Child node


Node name (Object) — Child node Returns: Succeeder node Create a Failer decorator Always returns FAILURE Parameters: (string) — Node name (Object) — Child node Returns: Failer node Create a Cooldown decorator Prevents child from running until cooldown expires Parameters: (string) — Node name (Object) — Child node (number) — Cooldown in milliseconds Returns: Cooldown node Create a Condition Guard decorator Only runs child if condition is met Parameters: (string) — Node name (Object) — Child node (Function) — Condition function (blackboard) = boolean Returns: Condition guard node Create an Action leaf node Parameters: (string) — Action name (Function) — Action function (blackboard, deltaTime) = NODE STATUS Returns: Action node Create a Condition leaf node Parameters: (string) — Condition name (Function) — Condition function (blackboard) = boolean Returns: Condition node Create a Wait leaf node Parameters: (string) — Node name (number) — Wait duration in milliseconds Returns: Wait node Create a Log leaf node (for debugging) Parameters: (string) — Node name (string) — Message to log Returns: Log node Tick a behavior tree node Parameters: (Object) — Node to tick (Object) — Blackboard data (number) — Delta time in ms Returns: NODE STATUS Reset a behavior tree node and all children Parameters: (Object) — Node to reset Create a behavior tree runner Parameters: (Object) — Root node of tree (Object) — Blackboard data Returns: Tree runner Tick the behavior tree Parameters: (Object) — Tree runner (number) — Delta time in ms Returns: NODE STATUS Create a common combat behavior tree Parameters: (Object) — Action implementations Returns: Root node Constants Re exports , <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics,


Returns: Root node Constants Re exports , <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision ma


createCoverPoint(position, normal, options = {})

detectCoverPoints(obstacles, sampleSpacing = 2)

scoreCoverPoint(cover, npcPos, threatPos, obstacles, options = {})

findBestCover(coverPoints, npcPos, threatPos, obstacles, options = {})

findFlankingPositions(targetPos, targetFacing, flankDistance, coverPoints, obstacles)

findRetreatCover(npcPos, threatPos, coverPoints, obstacles, minRetreatDist = 10)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create a cover point definition Parameters: (number[]) — [x, y, z] cover position (number[]) — [x, y, z] direction cover faces (away from threat) (Object) — Cover options Returns: Cover point Pre compute peek positions for a cover point Parameters: (Object) — Cover point Find cover points from obstacle geometry Parameters: (number) — Distance between sample points Returns: Cover points Score a cover point for a given tactical situation Parameters: (Object) — Cover point (number[]) — NPC current position (number[]) — Threat position (Object) — Scoring options Returns: Cover score (higher = better) Find best cover point from available options Parameters: (Array<Object ) — Available cover points (number[]) — NPC position (number[]) — Threat position (Array) — Obstacles (Object) — Options Returns: Best cover point or null Create NPC cover state tracker Returns: Cover state Enter cover at a cover point Parameters: (Object) — Cover state (Object) — Cover point to enter (number) — NPC ID Exit current cover Parameters: (Object) — Cover state Start peek action from cover Parameters: (Object) — Cover state (number) — COVER ACTION type (number) — Current time Returns: True if peek started Update cover state Parameters: (Object) — Cover state (number) — Current time Get current shoot position based on cover action Parameters: (Object) — Cover state (number[]) — Base NPC position Returns: Shoot position Check if NPC can shoot from current cover state Parameters: (Object) — Cover state Returns: } Apply suppression to an NPC Parameters: (Object) — Cover state (number) — Suppression


from current cover state Parameters: (Object) — Cover state Returns: } Apply suppression to an NPC Parameters: (Object) — Cover state (number) — Suppression duration in ms (number) — Current time Check if NPC is suppressed Parameters: (Object) — Cover state (number) — Current time Returns: True if suppressed Apply damage to cover point Parameters: (Object) — Cover point (number) — Damage amount Returns: True if cover was destroyed Find flanking positions around a target Parameters: (number[]) — Target position (number[]) — Target facing direction (number) — Distance to flank from (Array<Object ) — Available cover points (Array) — Obstacles Returns: } Flank positions Find retreat positions away from threat Parameters: (number[]) — NPC position (number[]) — Threat position (Array<Object ) — Available cover (Array) — Obstacles (number) — Minimum retreat distance Returns: Retreat cover points sorted by safety Constants — Cover quality thresholds — Cover action types <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See


collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


calculateSocialForce(agent, neighbors, walls, goal)

addAttractor(crowd, position, strength, radius)

triggerPanic(crowd, source, radius, intensity = 1)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Calculate social force (Helbing model) Parameters: (Object) — Agent (Array) — Nearby agents (Array) — Wall segments (number[]) — Goal position Returns: Force vector Create crowd agent Parameters: (number[]) — Position (Object) — Config Returns: Agent Create crowd system Parameters: (Object) — Config Returns: Crowd system Add agent to crowd Parameters: (Object) — Crowd system (Object) — Agent Remove agent from crowd Parameters: (Object) — Crowd system (string) — Agent ID Add wall to crowd system Parameters: (Object) — Crowd system (number[]) — Wall start (number[]) — Wall end Add attractor (draws crowd) Parameters: (Object) — Crowd system (number[]) — Position (number) — Pull strength (number) — Effect radius Trigger panic Parameters: (Object) — Crowd system (number[]) — Panic source position (number) — Panic radius (number) — Panic intensity 0 1 Set evacuation mode Parameters: (Object) — Crowd system Update crowd simulation Parameters: (Object) — Crowd system (number) — Seconds Get crowd statistics Parameters: (Object) — Crowd system Returns: Stats Constants — Crowd behavior modes — Individual agent states <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD)


Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


getDialogueFlag(state, flag, defaultValue = null)

selectChoice(state, choiceIndex, context = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create a dialogue tree Parameters: (string) — Tree ID (Object) — Tree config Returns: Dialogue tree Create a dialogue node Parameters: (Object) — Node config Returns: Dialogue node Add node to dialogue tree Parameters: (Object) — Dialogue tree (Object) — Node to add Create dialogue state for an NPC Returns: Dialogue state Add dialogue tree to NPC Parameters: (Object) — Dialogue state (Object) — Dialogue tree Set dialogue flag Parameters: (Object) — Dialogue state (string) — Flag name ( ) — Flag value Get dialogue flag Parameters: (Object) — Dialogue state (string) — Flag name ( ) — Default if not set Returns: Flag value Start conversation with NPC Parameters: (Object) — Dialogue state (Object) — Conversation context {playerId, relationship, etc.} Returns: First dialogue result Process current dialogue node Parameters: (Object) — Dialogue state (Object) — Context Returns: Dialogue result Select player choice Parameters: (Object) — Dialogue state (number) — Choice index (Object) — Context Returns: Next dialogue result Continue to next dialogue (for NPC lines) Parameters: (Object) — Dialogue state (Object) — Context Returns: Next dialogue result Fluent dialogue tree builder Parameters: (string) — Tree ID Returns: Builder Constants — Node types <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics


mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


updateSpawnDirector(director, pacing, playerPosition, deltaTime)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create player state tracker Returns: Player state Update player state metrics Parameters: (Object) — Player state (Object) — Raw gameplay data (number) — Time elapsed Create pacing controller Parameters: (Object) — Pacing config Returns: Pacing controller Update pacing state Parameters: (Object) — Pacing controller (Object) — Player state (number) — Seconds elapsed Returns: } Create spawn director Parameters: (Object) — Spawn config Returns: Spawn director Register spawn type Parameters: (Object) — Spawn director (number) — Intensity level (Object) — {type, weight, cost, count} Add spawn point Parameters: (Object) — Spawn director (Object) — {position, types, active} Update spawn director Parameters: (Object) — Spawn director (Object) — Pacing controller (number[]) — Player position (number) — Seconds elapsed Returns: Spawns to create Report spawn killed Parameters: (Object) — Spawn director (string) — Spawn ID Create difficulty scaler Parameters: (Object) — Config Returns: Difficulty scaler Update difficulty based on player performance Parameters: (Object) — Difficulty scaler (Object) — Player state (number) — Seconds elapsed Create complete AI Director Parameters: (Object) — Configuration Returns: AI Director Update AI Director Parameters: (Object) — AI Director (Object) — Current game state (number) — Seconds elapsed Returns: } Constants — Pacing states — Intensity levels <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass


Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


removeCreature(eco, creatureId, cause = "natural")

createFoodSource(eco, position, type, nutrition)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create species definition Parameters: (Object) — Species config Returns: Species definition Create creature instance Parameters: (Object) — Species definition (number[]) — Starting position Returns: Creature instance Create ecosystem manager Parameters: (Object) — Ecosystem config Returns: Ecosystem Register species in ecosystem Parameters: (Object) — Ecosystem (Object) — Species to register Spawn creature in ecosystem Parameters: (Object) — Ecosystem (string) — Species ID (number[]) — Position Returns: Created creature Remove creature from ecosystem Parameters: (Object) — Ecosystem (string) — Creature ID (string) — Death cause Create food source Parameters: (Object) — Ecosystem (number[]) — Position (string) — "plant", "carcass", "fruit" (number) — Nutritional value Consume food source Parameters: (Object) — Ecosystem (string) — Food source ID (number) — Amount to consume Returns: Actual amount consumed Create pack/herd Parameters: (Object) — Ecosystem (string) — Species ID (string) — Leader creature ID Returns: Pack Add creature to pack Parameters: (Object) — Ecosystem (string) — Pack ID (string) — Creature ID Update creature behavior Parameters: (Object) — Ecosystem (Object) — Creature to update (number) — Game hours elapsed Update entire ecosystem Parameters: (Object) — Ecosystem (number) — Game hours elapsed Get ecosystem statistics Parameters: (Object) — Ecosystem Returns: Statistics Constants — Species roles in ecosystem — Activity states <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision


roles in ecosystem — Activity states <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


initMarketResource(market, resource, initialSupply = 100, baseDemand = 10)

buyFromMarket(market, resourceId, quantity, buyer)

sellToMarket(market, resourceId, quantity, seller)

addToInventory(inventory, resourceId, quantity, resourceDef)

removeFromInventory(inventory, resourceId, quantity, resourceDef)

canCraft(recipe, inventory, skills = {})

craft(recipe, inventory, resourceDefs, skills = {})

updateProductionBuilding(building, recipes, resourceDefs, deltaHours)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create resource definition Parameters: (Object) — Resource config Returns: Resource definition Create a market (trading location) Parameters: (Object) — Market config Returns: Market Initialize resource in market Parameters: (Object) — Market (Object) — Resource definition (number) — Initial supply (number) — Base demand per day Calculate current price based on supply/demand Parameters: (Object) — Market (string) — Resource ID Returns: Current price Update market prices Parameters: (Object) — Market (number) — Hours elapsed Execute a buy transaction Parameters: (Object) — Market (string) — Resource ID (number) — Quantity to buy (Object) — Buyer {id, gold} Returns: } Execute a sell transaction Parameters: (Object) — Market (string) — Resource ID (number) — Quantity to sell (Object) — Seller {id, gold} Returns: } Create inventory Parameters: (number) — Max weight capacity Returns: Inventory Add items to inventory Parameters: (Object) — Inventory (string) — Resource ID (number) — Quantity to add (Object) — Resource definition Returns: Quantity actually added Remove items from inventory Parameters: (Object) — Inventory (string) — Resource ID (number) — Quantity to remove (Object) — Resource definition Returns: Quantity actually removed Create crafting recipe Parameters: (Object) — Recipe config Returns: Recipe Check if can craft recipe Parameters: (Object) — Recipe (Object) — Crafter's inventory (Object) — Crafter's skills {skillName: level} Returns: } Execute crafting Parameters: (Object) — Recipe (Object) — Crafter's inventory (Object) — Map of resource definitions


skills {skillName: level} Returns: } Execute crafting Parameters: (Object) — Recipe (Object) — Crafter's inventory (Object) — Map of resource definitions (Object) — Crafter's skills (will be modified) Returns: } Create production building Parameters: (Object) — Building config Returns: Production building Update production building Parameters: (Object) — Production building (Object) — Map of recipes (Object) — Map of resource definitions (number) — Hours elapsed Returns: } Create economy manager Returns: Economy manager Register resource Parameters: (Object) — Economy manager (Object) — Resource definition Register recipe Parameters: (Object) — Economy manager (Object) — Recipe definition Update entire economy Parameters: (Object) — Economy manager (number) — Hours elapsed Constants — Resource categories — Market trend directions <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


startDodge(state, dodgeType, npcPos, npcFacing, now)

reactToThreat(state, npcPos, npcFacing, threatDir, now, options = {})

checkProjectileThreats(state, npcPos, npcFacing, projectiles, now)

checkGrenadeThreats(state, npcPos, npcFacing, grenades, now)

generateCombatMovement(state, npcPos, targetPos, deltaTimeMs)

circleStrafe(npcPos, targetPos, direction, speed)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create evasion state for an NPC Parameters: (Object) — Evasion parameters Returns: Evasion state Attempt to dodge in a direction Parameters: (Object) — Evasion state (number) — EVASION TYPE (number[]) — NPC position (number[]) — NPC facing direction (number) — Current time Returns: True if dodge started Update evasion state Parameters: (Object) — Evasion state (number) — Current time Returns: } Check if NPC is currently evading Parameters: (Object) — Evasion state Returns: True if in evasion action Check if NPC can dodge Parameters: (Object) — Evasion state (number) — Current time Returns: True if dodge is available Update strafe behavior Parameters: (Object) — Evasion state (number[]) — NPC facing direction (number) — Delta time in ms Returns: Strafe velocity [x, y, z] Set explicit strafe direction Parameters: (Object) — Evasion state (number) — 1 (left), 0 (none), 1 (right) React to incoming threat (projectile, attack) Parameters: (Object) — Evasion state (number[]) — NPC position (number[]) — NPC facing (number[]) — Direction threat is coming from (number) — Current time (Object) — Reaction options Returns: True if evasion started Check for incoming projectiles and react Parameters: (Object) — Evasion state (number[]) — NPC position (number[]) — NPC facing (number) — Current time Returns: True if evasion triggered Check for grenades and react Parameters: (Object) — Evasion state (number[]) — NPC position (number[]) — NPC facing (number) — Current time Returns: } Generate unpredictable movement pattern Parameters: (Object) — Evasion state (number[]) — NPC position


— NPC facing (number) — Current time Returns: } Generate unpredictable movement pattern Parameters: (Object) — Evasion state (number[]) — NPC position (number[]) — Target position (number) — Delta time in ms Returns: Movement velocity Calculate circle strafe velocity around target Parameters: (number[]) — NPC position (number[]) — Target position (number) — 1 (counter clockwise) or 1 (clockwise) (number) — Movement speed Returns: Circle strafe velocity Get evasion parameters for skill level Parameters: (string) — "novice", "average", "expert" Returns: Evasion parameters Constants — Evasion action types — Default evasion parameters <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


setDiplomaticStance(manager, factionA, factionB, stance)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create a faction Parameters: (Object) — Faction configuration Returns: Faction Create faction manager Returns: Faction manager Register a faction Parameters: (Object) — Faction manager (Object) — Faction to register Get entity's faction Parameters: (Object) — Faction manager (number) — Entity ID Returns: Faction Add entity to faction Parameters: (Object) — Faction manager (number) — Entity ID (string) — Faction ID Set diplomatic stance between factions Parameters: (Object) — Faction manager (string) — First faction ID (string) — Second faction ID (number) — DIPLOMATIC STANCE value Get diplomatic stance between factions Parameters: (Object) — Faction manager (string) — First faction ID (string) — Second faction ID Returns: DIPLOMATIC STANCE value Check if factions are hostile Parameters: (Object) — Faction manager (string) — First faction ID (string) — Second faction ID Returns: Are hostile Check if factions are allied Parameters: (Object) — Faction manager (string) — First faction ID (string) — Second faction ID Returns: Are allied Check if two entities are hostile to each other Parameters: (Object) — Faction manager (number) — First entity ID (number) — Second entity ID Returns: Are hostile Modify player reputation with faction Parameters: (Object) — Faction manager (string) — Faction ID (number) — Reputation change Get player reputation level with faction Parameters: (Object) — Faction manager (string) — Faction ID Returns: {level: string, value: number} Check if player can access faction services Parameters: (Object) — Faction manager (string) — Faction ID (string) —


ID Returns: {level: string, value: number} Check if player can access faction services Parameters: (Object) — Faction manager (string) — Faction ID (string) — Service type Returns: Can access Create a treaty Parameters: (Object) — Treaty config Returns: Treaty Propose treaty Parameters: (Object) — Faction manager (Object) — Treaty to propose Returns: Was accepted Declare war Parameters: (Object) — Faction manager (string) — Aggressor faction ID (string) — Target faction ID Claim territory for faction Parameters: (Object) — Faction manager (string) — Faction ID (string) — Territory ID Get territory owner Parameters: (Object) — Faction manager (string) — Territory ID Returns: Owner faction ID Calculate faction power Parameters: (Object) — Faction manager (string) — Faction ID Returns: Power score Constants — Diplomatic stance — Reputation thresholds from AISchema — Treaty types Re exports <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


assignToFormation(manager, unitId, isLeader = false)

moveFormation(manager, targetCenter, targetFacing = null)

changeFormation(manager, newType, options = {})

isFormationComplete(manager, currentPositions, threshold = 1)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create formation definition Parameters: (string) — Formation type (Object) — Formation options Returns: Formation definition Generate formation slot positions Parameters: (Object) — Formation (number) — Number of units Returns: } Slot definitions Create formation manager for a group Parameters: (Object) — Formation definition Returns: Formation manager Assign unit to formation slot Parameters: (Object) — Formation manager (number) — Unit ID (boolean) — Is this the leader Returns: Assigned slot index Remove unit from formation Parameters: (Object) — Formation manager (number) — Unit ID Get unit's target position in formation Parameters: (Object) — Formation manager (number) — Unit ID Returns: World position Move formation to target Parameters: (Object) — Formation manager (number[]) — Target center position (number[]) — Target facing direction (optional) Update formation movement Parameters: (Object) — Formation manager (number) — Delta time in seconds Returns: Formation reached destination Change formation type Parameters: (Object) — Formation manager (string) — New formation type (Object) — Formation options Get all unit target positions Parameters: (Object) — Formation manager Returns: Unit ID → target position Check if formation is formed up Parameters: (Object) — Formation manager (Map<number, number[] ) — Current unit positions (number) — Distance threshold Returns: Is formed up Constants — Formation patterns — Create preset formations for common scenarios <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics,


— Create preset formations for common scenarios <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


sweptSphereSphere(sphereStart, sphereEnd, sphereRadius, targetCenter, targetRadius)

capsuleSphereIntersect(capsuleStart, capsuleEnd, capsuleRadius, targetCenter, targetRadius)

calculateDamageFalloff(baseDamage, distance, radius, falloffType = FALLOFFTYPE.LINEAR, options = {})

getAoETargets(center, radius, targets, options = {})

getConeTargets(origin, direction, halfAngle, range, targets, options = {})

checkProjectileHit(projectile, targets, options = {})

checkBeamHit(origin, direction, maxRange, targets, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Classes Spatial hash for efficient broad phase collision detection Method Signature Summary Hash a world position to cell key Clear all entries Insert an entity at a position Remove an entity Query all entities within radius of a position Query entities along a ray/path (for swept collision) Functions Swept sphere vs static sphere intersection Finds time t in [0,1] when moving sphere first touches static sphere Parameters: (number[]) — Moving sphere center at t=0 (number[]) — Moving sphere center at t=1 (number) — Moving sphere radius (number[]) — Static sphere center (number) — Static sphere radius Returns: {t, point, normal} or null if no hit Swept sphere vs moving sphere intersection Handles both objects moving (relative velocity approach) Parameters: (Object) — {start, end, radius} (Object) — {start, end, radius} Returns: {t, point, normal} or null Swept capsule collision (projectile path as line segment) Creates a capsule from start to end position with given radius Parameters: (number[]) — Capsule line start (number[]) — Capsule line end (number) — Capsule radius (number[]) — Target sphere center (number) — Target sphere radius Returns: {t, point, normal, distance} or null Calculate damage with distance falloff Parameters: (number) — Maximum damage at center (number) — Distance from effect center (number) — Effect radius (string) — Type of falloff curve (Object) — Additional options Returns: Calculated damage Find all targets within an Area of Effect Parameters: (number[]) — AoE center position (number) — AoE radius (Array) — Array of {id, position, radius} (Object) —


all targets within an Area of Effect Parameters: (number[]) — AoE center position (number) — AoE radius (Array) — Array of {id, position, radius} (Object) — Detection options Returns: Array of {target, distance, damage} Cone shaped AoE (dragon breath, flamethrower) Parameters: (number[]) — Cone apex (number[]) — Cone direction (normalized) (number) — Half angle in radians (number) — Cone length (Array) — Array of {id, position, radius} (Object) — Detection options Returns: Array of {target, distance, damage, angle} Check projectile hit with swept collision and spatial optimization Parameters: (Object) — {prevPosition, position, radius, velocity, ownerId} (Array) — Array of {id, position, radius} (Object) — Detection options Returns: {target, t, point, normal, damage} or null Check beam/ray hit against multiple targets Parameters: (number[]) — Ray origin (number[]) — Ray direction (normalized) (number) — Maximum ray length (Array) — Array of {id, position, radius} or {id, min, max} for AABB (Object) — Detection options Returns: {target, t, point, normal} Constants — Damage falloff types — Hitbox types <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to


A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


createInfluenceLayer(width, height, cellSize, origin = [0, 0])

createInfluenceMap(width, height, cellSize, origin = [0, 0])

setInfluenceAt(layer, worldX, worldZ, value)

addInfluenceAt(layer, worldX, worldZ, value)

stampInfluence(layer, worldX, worldZ, radius, value, falloff = "linear")

propagateInfluence(layer, decayFactor = 0.9)

findLowestInfluence(layer, worldX, worldZ, searchRadius)

findHighestInfluence(layer, worldX, worldZ, searchRadius)

sampleCombinedInfluence(map, worldX, worldZ, weights)

reservePath(map, path, reserveValue = 1.0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create an influence map layer Parameters: (number) — Grid width (number) — Grid height (number) — World units per cell (number[]) — World origin [x, z] Returns: Influence layer Create a multi layer influence map Parameters: (number) — Grid width (number) — Grid height (number) — World units per cell (number[]) — World origin Returns: Influence map World position to grid cell Parameters: (Object) — Influence map/layer (number) — World X (number) — World Z Returns: } Grid coords Grid cell to world position (center of cell) Parameters: (Object) — Influence map/layer (number) — Cell X (number) — Cell Y Returns: } World position Get influence value at world position Parameters: (Object) — Influence layer (number) — World X (number) — World Z Returns: Influence value Set influence value at world position Parameters: (Object) — Influence layer (number) — World X (number) — World Z (number) — Influence value Add influence at world position Parameters: (Object) — Influence layer (number) — World X (number) — World Z (number) — Value to add Stamp circular influence at position Parameters: (Object) — Influence layer (number) — Center X (number) — Center Z (number) — World radius (number) — Peak value at center (string) — "linear", "quadratic", "constant" Propagate influence to neighboring cells (blur/spread) Parameters: (Object) — Influence layer (number) — Decay per propagation step (0 1) Decay all influence values Parameters: (Object) — Influence layer (number) — Amount to decay per call Clear all influence Parameters: (Object) — Influence layer Find position with lowest


Parameters: (Object) — Influence layer (number) — Amount to decay per call Clear all influence Parameters: (Object) — Influence layer Find position with lowest influence in radius Parameters: (Object) — Influence layer (number) — Center X (number) — Center Z (number) — Search radius in world units Returns: null} Best position Find position with highest influence in radius Parameters: (Object) — Influence layer (number) — Center X (number) — Center Z (number) — Search radius Returns: null} Best position Sample combined influence from multiple layers Parameters: (Object) — Influence map (number) — World X (number) — World Z (Object) — Layer weights {threat: 1, ally: 1, cover: 0.5} Returns: Combined influence Analyze terrain for choke points Parameters: (Object) — Grid with walkable cells marked (Object) — Influence map to store results Returns: } Choke points Update threat layer from enemy positions Parameters: (Object) — Influence map Update ally layer from friendly positions Parameters: (Object) — Influence map Reserve a path on the influence map Parameters: (Object) — Influence map (number) — Reservation strength Clear path reservation Parameters: (Object) — Influence map <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable


collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


distortKnowledge(knowledge, distortion = 0.1)

shareKnowledge(giver, receiver, knowledge, giverNpcId)

spreadKnowledge(network, knowledge, originNpcId, maxHops = 3)

registerNPCKnowledge(manager, npcId, config = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create knowledge item Parameters: (Object) — Knowledge config Returns: Knowledge item Create a distorted copy (for rumor spreading) Parameters: (Object) — Original knowledge (number) — Distortion amount Returns: Distorted copy Create NPC knowledge base Returns: Knowledge base Add knowledge to NPC's knowledge base Parameters: (Object) — Knowledge base (Object) — Knowledge to add Returns: Whether knowledge was new/updated Query knowledge base Parameters: (Object) — Knowledge base (Object) — {subject?, type?, tag?, minReliability?} Returns: Matching knowledge Check if NPC knows about something Parameters: (Object) — Knowledge base (string) — Subject to check Returns: Has knowledge Share knowledge between NPCs Parameters: (Object) — Giver's knowledge base (Object) — Receiver's knowledge base (Object) — Knowledge to share (Object) — Giver's NPC ID Returns: } Spread knowledge through social network Parameters: (Object) — Social network manager (Object) — Knowledge to spread (string) — Origin NPC ID (number) — Maximum spread distance Create world knowledge manager Returns: Knowledge manager Register NPC with knowledge system Parameters: (Object) — Knowledge manager (string) — NPC ID (Object) — {interests, trustedSources} Connect two NPCs in social network Parameters: (Object) — Knowledge manager (string) — First NPC ID (string) — Second NPC ID Announce public knowledge Parameters: (Object) — Knowledge manager (Object) — Knowledge to announce Update knowledge propagation Parameters: (Object) — Knowledge manager (number) — Current game time Constants — Information types —


— Knowledge to announce Update knowledge propagation Parameters: (Object) — Knowledge manager (number) — Current game time Constants — Information types — Information reliability <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have shapes (box, sphere, mesh), mass properties, and constraints. The GPU physics engine accelerates broad phase collision detection and particle systems. Example: Creating physics bodies Advanced: Collision detection and raycasting Advanced: Constraints and joints Advanced: Continuous collision detection (CCD) Gotchas: Units : Physics uses meters, kilograms, seconds. A 1 unit cube is 1 meter. Time step : Fixed time step (1/60) gives stable simulation; variable dt causes explosions. Collision layers : Use collision masks to filter what collides (player vs enemy, bullet vs world). Sleeping : At rest bodies sleep to save CPU — wake them before applying forces. See also: Physics · GPU Physics Engine


createItemInstance(itemDef, options = {})

rollLootTable(table, itemDefs, context = {})

dropLoot(manager, tableId, position, context = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: No file level description found in source. Add one as a leading JSDoc comment, or document it below. Functions Create item definition Parameters: (Object) — Item config Returns: Item definition Create item instance from definition Parameters: (Object) — Item definition (Object) — Instance options Returns: Item instance Create affix definition Parameters: (Object) — Affix config Returns: Affix Apply affix to item Parameters: (Object) — Item instance (Object) — Affix definition Returns: Success Generate item name from affixes Parameters: (Object) — Item instance Returns: Generated name Create loot table entry Parameters: (Object) — Entry config Returns: Loot entry Create loot table Parameters: (Object) — Table config Returns: Loot table Roll loot from table Parameters: (Object) — Loot table (Object) — Map of item definitions (Object) — Context {level, luck, conditions} Returns: Dropped items Roll rarity based on luck Parameters: (number) — Luck bonus Returns: Rarity Create loot manager Returns: Loot manager Register item definition Parameters: (Object) — Loot manager (Object) — Item definition Register affix Parameters: (Object) — Loot manager (Object) — Affix definition Register loot table Parameters: (Object) — Loot manager (Object) — Loot table Drop loot at position Parameters: (Object) — Loot manager (string) — Loot table ID (number[]) — World position (Object) — Drop context Returns: Dropped items Clean up expired drops Parameters: (Object) — Loot manager Constants — Rarity tiers — Rarity color codes — Item categories <! HUMAN NOTES Notes & Examples Physics Engine Integration The physics system provides rigid body dynamics, collision detection, and raycasting. Bodies have