secondsToFrames(seconds, frameRate = DEFAULTFRAMERATE)

framesToSeconds(frames, frameRate = DEFAULTFRAMERATE)

millisecondsToFrames(milliseconds, frameRate = DEFAULTFRAMERATE)

framesToMilliseconds(frames, frameRate = DEFAULTFRAMERATE)

secondsToSamples(seconds, sampleRate = DEFAULTSAMPLERATE)

samplesToSeconds(samples, sampleRate = DEFAULTSAMPLERATE)

sampleIndexAtTime(seconds, sampleRate = DEFAULTSAMPLERATE)

samplesToMilliseconds(samples, sampleRate = DEFAULTSAMPLERATE)

millisecondsToSamples(milliseconds, sampleRate = DEFAULTSAMPLERATE)

secondsToBeats(seconds, bpm = DEFAULTBPM)

frequencyToWavelengthMeters(frequencyHz, waveSpeed = SPEEDOFLIGHT)

wavelengthMetersToFrequencyHz(wavelengthMeters, waveSpeed = SPEEDOFLIGHT)

powerRatioToDb(powerRatio, floorDb = -Infinity)

frequencyRatioToCents(ratio, floorCents = -Infinity)

cssPixelsToDevicePixels(cssPixels, devicePixelRatio = 1)

devicePixelsToCssPixels(devicePixels, devicePixelRatio = 1)

worldUnitsToGridIndex(worldValue, cellSize = 1, origin = 0)

gridIndexToWorldUnits(gridIndex, cellSize = 1, origin = 0, centered = false)

worldUnitsToChunkIndex(worldValue, chunkCells = 16, cellSize = 1, origin = 0)

chunkIndexToWorldUnits(chunkIndex, chunkCells = 16, cellSize = 1, origin = 0, centered = false)

worldUnitsToLocalChunkIndex(worldValue, chunkCells = 16, cellSize = 1, origin = 0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: UnitMath.js deterministic scalar unit conversion helpers. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


videoSequenceReport(frames, options = {})

videoTemporalBlendFrame(referenceFrame, candidateFrame, amount = 0.5, options = {})

videoSceneListReport(frames, options = {})

videoKeyframePlanReport(frames, options = {})

videoMotionEntropyReport(frames, options = {})

videoTemporalEntropyReport(frames, options = {})

videoThumbnailCandidateReport(frames, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: VideoMath.js pure sequence level video/frame math over ImageData like frames. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


wgslRegistryById(id, registry = WGSLREGISTRY)

wgslMirrorsForChunk(chunkId, mirrors = WGSLMIRRORREGISTRY)

wgslRegistryReport(chunks = WGSLCHUNKREGISTRY, mirrors = WGSLMIRRORREGISTRY, moduleExports = WGSLMODULEEXPORTS, moduleExportClassifications = WGSLMODULEEXPORTCLASSIFICATIONS)

mathRegistryWGSLMirrorReport(mathFunctions = MATHFUNCTIONREGISTRY, wgslMirrors = WGSLMIRRORREGISTRY)

wgslRegistryManifest(chunks = WGSLCHUNKREGISTRY, mirrors = WGSLMIRRORREGISTRY)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: WGSLRegistry.js metadata for reusable WGSL chunks and CPU/WGSL mirror links. Functions Constants <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


xrRigidTransformReport(transform = {}, options = {})

xrPoseViewMatrix(transform = {}, options = {})

xrViewProjectionReport(view = {}, options = {})

xrViewerPoseReport(views = [], options = {})

xrReferenceSpaceOffsetReport(baseTransform = {}, offsetTransform = {}, options = {})

xrDepthRawToMeters(rawDepth, rawValueToMeters = 1)

xrDepthUvTransformPoint(point = {}, matrix = identity4()

xrDepthSampleIndex(width, height, u, v, options = {})

xrDepthSampleMeters(depthData, width, height, u, v, options = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: XRMath.js pure WebXR shaped pose, view, projection, and depth reports. Functions <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/math/index.js
Re-exports
Notes & Examples
Math Library Conventions

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: engine/core/math/index.js Math Utilities Barrel Export Re exports , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples Math Library Conventions The math library provides vector, matrix, quaternion, and utility operations. All math functions follow consistent patterns: pure functions return new values, variants write to an output parameter (zero allocation), and out parameters come first . Matrices are column major for WebGPU compatibility. Example: Common math operations See also: Math Library


core/memory/ChunkBufferPool.js
Classes
class ChunkBufferPool
Functions
getChunkBufferPool()
Notes & Examples

<! 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 Pre allocate buffers to avoid cold start allocations Get a voxel buffer (reused or new) Return a voxel buffer to the pool Get a mesh vertex buffer (Float32Array) Return a mesh vertex buffer to the pool Get a mesh index buffer (Uint32Array) Return a mesh index buffer to the pool Clear all pools (for memory pressure situations) Get pool statistics Functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/GPUMemoryManager.js
Classes
class RingBuffer
class BuddyAllocator
class StagingBufferPool
class BindGroupCache
class TextureManager
class GPUMemoryManager
Functions
getGPUMemoryManager(device)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: GPUMemoryManager.js WebGPU Device Memory Management Implements: Ring Buffer for dynamic uniform data (per frame) Buddy Allocator for static geometry (persistent) Texture Atlas management with LRU eviction BindGroup caching and deduplication Goal: Minimize GPU API calls and prevent VRAM fragmentation Classes Circular buffer for per frame dynamic data (uniforms, instance data). Wraps around each frame, avoiding buffer creation overhead. Method Signature Summary Begin a new frame mark frame boundary Allocate bytes from the ring buffer Write data to the ring buffer Get the underlying GPU buffer Get statistics Destroy the buffer Buddy allocator for persistent GPU memory (geometry, textures). Handles allocation/deallocation without fragmentation. Method Signature Summary Get tree node index for given order and index within that order Allocate memory from the buddy heap Recursive block allocation Update parent nodes after allocation Free previously allocated memory Recursive block freeing with coalescing Coalesce buddies after freeing Write data to allocated region Allocate and write in one call Get the underlying GPU buffer Get statistics Destroy the buffer Pool of mappable staging buffers for CPU GPU transfers. Avoids creating new buffers for every upload. Method Signature Summary Get a staging buffer for writing Release a staging buffer after use Reclaim buffers that GPU has finished with Get statistics Destroy all buffers Cache for GPUBindGroup objects to avoid redundant creation. Uses content based hashing for deduplication. Method Signature Summary Generate hash key for bind group descriptor Get or create a bind group Evict least recently used entries Clear the cache Get


Method Signature Summary Generate hash key for bind group descriptor Get or create a bind group Evict least recently used entries Clear the cache Get statistics Manages GPU textures with LRU eviction policy. Method Signature Summary Calculate texture memory size Create or get a texture Get texture by ID (marks as recently used) Evict least recently used texture Manually destroy a texture Get statistics Destroy all textures Central GPU memory management facade. Method Signature Summary Initialize all sub managers Begin new frame Allocate uniform data Allocate vertex data (dynamic, per frame) Allocate static geometry Free static geometry Get or create bind group Get comprehensive statistics Log memory report Handle device loss prepare for reinitialization Destroy all resources Functions Get or create GPU memory manager singleton Parameters: (GPUDevice) — No description in source JSDoc. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/HostMemoryManager.js
Classes
class SlabAllocator
class ObjectPool
class SoAContainer
class HostMemoryManager
Functions
createCommonPools(manager = hostMemory)
Constants
Notes & Examples

<! 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 Linear allocator that resets every frame. Provides zero cost TypedArray views into a pre allocated buffer. Method Signature Summary Align cursor to specified boundary Allocate raw bytes from the slab Allocate from overflow page when main slab is full Allocate a Float32Array view Allocate a Uint32Array view Allocate a Uint8Array view Allocate a 4x4 matrix (16 floats, 64 bytes) Allocate a Vec3 (3 floats, padded to 4 for alignment) Allocate a Vec4 (4 floats) Allocate uniform buffer aligned memory Reset the allocator for a new frame Call this at the START of each frame Get usage statistics Generic object pool for reusable JavaScript objects. Uses LIFO (stack) for hot cache retrieval. Method Signature Summary Create a new object via factory Acquire an object from the pool Release an object back to the pool Expand pool capacity Pre warm the pool by allocating and immediately freeing Get pool statistics Enable debug mode (seals new objects) SoA container for cache efficient mass entity storage. All properties stored in contiguous TypedArrays. Method Signature Summary Allocate a new entity slot Free an entity slot Check if entity is active Get property value for entity Set property value for entity Set all components of a property Get raw array for direct access (faster for bulk operations) Iterate over all active entities Compact the arrays by removing gaps (expensive, use sparingly) Get statistics Central manager for all host memory allocation. Method Signature Summary Create a new slab allocator Get slab by name Create a new object pool Get pool by name Create a new SoA


all host memory allocation. Method Signature Summary Create a new slab allocator Get slab by name Create a new object pool Get pool by name Create a new SoA container Get container by name Reset all frame allocators call at START of each frame End frame processing Get comprehensive memory statistics Log memory report to console Functions Create common pools for game objects Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/MappedBufferRing.js
Classes
class MappedBufferRing
Notes & Examples

<! 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 MappedBufferRing Efficient GPU data upload with pre mapped buffers Method Signature Summary Initialize the buffer ring Get the size bucket for a given size Create a new mapped buffer Get a mapped buffer of at least the requested size Write data and copy to target buffer Write uniform data efficiently Schedule a buffer to be reclaimed after GPU is done Get statistics Destroy all buffers <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/ObjectPool.js
Classes
class ObjectPool
Functions
acquireVec3(x = 0, y = 0, z = 0)
releaseVec3(v)
acquireChunkInfo(cx, cy, cz)
releaseChunkInfo(info)
acquireRayResult()
releaseRayResult(result)
getPoolStats()
Constants
Notes & Examples

<! 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 Generic object pool with factory function Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/PipelineCache.js
Classes
class PipelineCache
Notes & Examples

<! 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 PipelineCache Async pipeline compilation and caching Method Signature Summary Initialize the cache Warmup by compiling multiple pipelines in parallel Create a render pipeline asynchronously Create a compute pipeline asynchronously Create render pipeline synchronously (use only if async not possible) Create compute pipeline synchronously Get a cached render pipeline Get a cached compute pipeline Get a cached bind group layout Check if a render pipeline exists Check if a compute pipeline exists Wait for a pipeline to be ready Get statistics Load configuration from engine.cfg section Destroy all pipelines <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/RenderBundleCache.js
Classes
class RenderBundleCache
Notes & Examples

<! 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 RenderBundleCache Manages render bundles for voxel terrain Method Signature Summary Initialize the render bundle cache Mark bundles as needing rebuild (call when chunks change) Check if bundles need rebuild Build opaque terrain render bundle Build water/transparent render bundle Execute the opaque bundle Execute the water bundle Get statistics Load configuration from engine.cfg section Destroy cached bundles <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/SubChunkBufferPool.js
Classes
class SubChunkBufferPool
Functions
getBufferPool()
initBufferPool(device)
Re-exports
Notes & Examples

<! 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 SubChunkBufferPool Manages GPU buffer reuse for sub chunk meshes Method Signature Summary Initialize the buffer pool Acquire a vertex buffer of at least the specified size Acquire an index buffer of at least the specified size Acquire an indirect draw buffer Return a vertex buffer to the pool Return an index buffer to the pool Return an indirect buffer to the pool Return all buffers from a sub chunk mesh result Update hit rate statistic Update total bytes pooled Clear all pooled buffers (call on context loss or cleanup) Get pool statistics Functions Get the global buffer pool instance Initialize the global buffer pool Parameters: (GPUDevice) — No description in source JSDoc. Re exports , <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/UniformBufferRing.js
Classes
class UniformBufferRing
class FrameUniformManager
Notes & Examples

<! 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 UniformBufferRing Rotating uniform buffers Method Signature Summary Initialize the buffer ring Get the buffer to write to this frame Get the current buffer index Advance to the next buffer (call at end of frame) Write data to the current buffer Create or get a bind group for the current buffer Get buffer at specific index Get all buffers Destroy all buffers FrameUniformManager Manages per frame uniforms with automatic rotation Method Signature Summary Initialize the manager Create a new uniform ring Get a ring by name Write to a ring's current buffer Get the write buffer for a ring Advance all rings to next buffer (call at end of frame) Get frame index Destroy all rings <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/VertexPool.js
Classes
class VertexPool
class FaceOrientedVertexPool
Notes & Examples

<! 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 VertexPool Manages a large persistent vertex buffer with bucket allocation Method Signature Summary Initialize the vertex pool Allocate a bucket for a chunk Free a bucket Update vertex data for a bucket Sort chunks front to back for early Z optimization Apply back face culling based on camera direction Masks out faces that point away from camera Upload draw commands to GPU Get visible bucket count for rendering Get bucket info for a chunk Iterate over visible buckets for rendering Get statistics Destroy the vertex pool FaceOrientedVertexPool Vertex pool with 6 sub buckets per chunk for true back face culling Each chunk gets 6 smaller buckets, one per face direction Method Signature Summary Allocate buckets for a chunk (one per face direction) Free all buckets for a chunk Update face data for a chunk Update visible faces based on camera direction (true back face culling) Render all visible chunks with true back face culling Only renders face pools that are visible from camera direction Load configuration from engine.cfg section <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/memory/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/platform/MainLoop.js
Functions
createMainLoop(options = {})
Notes & Examples


createCanvasSurface(gpuDevice, canvasTarget, options = {})

createViewportManager(gpuDevice, options = {})


core/profiler/DualRNG.js
Classes
class DualRNG
Functions
positionHash(x, y, z, seed = 0)
getGlobalRNG()
initGlobalRNG(seed)
Notes & Examples

<! 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 DualRNG Manages synchronized and visual RNGs Method Signature Summary Reset synchronized RNG to initial state Call this when resyncing with server Reset visual RNG (optional, for testing) Get synchronized random number [0, 1) MUST be called in same order on all clients! Synchronized random integer in range [min, max] inclusive Synchronized random float in range [min, max) Synchronized random boolean with given probability Synchronized random item from array Synchronized shuffle (Fisher Yates) Get visual random number [0, 1) Does NOT need to sync across clients Visual random integer in range [min, max] inclusive Visual random float in range min, max) Visual random boolean Visual random item from array Get deterministic random value for a position Same position always returns same value Get deterministic int at position Get deterministic float at position Get deterministic bool at position Get current state for sync verification Verify sync state matches another client Enable call logging for debugging sync issues Get sync call log for comparison with other clients Compare sync logs from two clients to find divergence point Functions Position based hash for deterministic randomness at specific coordinates Useful for terrain generation where you need same result for same position Get or create global DualRNG instance Initialize global RNG with seed (call from game init) <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see [API Reference Standard.


core/profiler/FrameBudgetManager.js
Classes
class FrameBudgetManager
Functions
getFrameBudgetManager()
shouldSkipWork(section)
Re-exports
Notes & Examples

<! 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 FrameBudgetManager Manages per frame time budgets Method Signature Summary Begin a new frame Begin update section End update section and calculate time spent Begin render section End render section End frame and update statistics Check if we're over the update budget Check if we're over a specific sub budget Get remaining time for a section Get throttle multiplier for a section (0 1) Calculate max work items for this frame based on throttle Queue work for later frames Process queued work within budget Get queue depth Adjust throttles when over budget Gradually restore throttles when under budget Set custom budget for a section Get statistics Reset statistics Functions Get global frame budget manager Quick check if we should skip work this frame Re exports <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/profiler/GameplayProfiler.js
Classes
class GameplayProfiler
Constants
Notes & Examples

<! 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 with game reference Start profiling session Stop profiling and generate analysis Update call each frame from game loop Get current results Run auto tuning benchmark to find optimal settings for this hardware Get auto tune results for saving Generate config string for engine.cfg [frame budget] section Apply auto tuned settings to game runtime Apply recommendations to game config Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/profiler/PerformanceOptimizer.js
Classes
class WorkgroupTuner
class PingPongBuffer
class FrameBudgetManager
class BufferPool
class PerformanceOptimizer
Constants
Notes & Examples

<! 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 Get optimal workgroup size for a kernel type Calculate dispatch dimensions Benchmark different workgroup sizes Method Signature Summary Get current read buffer Get current write buffer Swap buffers (call after write is complete) Get buffer by index Get all buffers Method Signature Summary Start frame timing Start a phase End a phase End frame and analyze Check if phase is within budget Get recommended particle count based on budget Get stats Method Signature Summary Allocate a buffer from pool Return buffer to pool Get memory stats Destroy all pooled buffers Method Signature Summary Create or get cached pipeline Create ping pong buffer Get optimal dispatch for kernel Start frame timing End frame and get stats Get comprehensive stats Cleanup Constants — Common workgroup sizes — Buffer strategies — Memory allocation tiers — Frame budget targets <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/profiler/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/profiling/PerformanceAnalyzer.js
Classes
class PerformanceAnalyzer
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/save/SaveSystem.js
Classes
class SaveSystem
Functions
createLocalStorageAdapter(storage)
Constants
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/save/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/scheduler/TaskScheduler.js
Classes
class Job
class WorkerPool
class TaskScheduler
Constants
Notes & Examples

<! 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 Represents a unit of work Method Signature Summary Execute the job Get execution duration Cancel the job Pool of Web Workers for parallel job execution Method Signature Summary Initialize workers Submit job to worker pool Dispatch job to specific worker Handle worker message Handle worker error Process queued jobs Get shared memory view for direct worker communication Wait for all pending jobs to complete Get statistics Terminate all workers Main task scheduler with frame budget management Method Signature Summary Initialize scheduler with optional worker pool Register a system for ordered updates Unregister a system Submit a job Submit critical job (must run this frame) Submit high priority job Submit low priority job Submit idle job (only runs during idle time) Submit job to worker pool Begin frame processing Process jobs within frame budget Update registered systems in order End frame processing Check if job dependencies are satisfied Execute a job synchronously Defer old jobs that missed their frame Schedule idle work processing Process idle work Fallback idle processing for browsers without requestIdleCallback Get time remaining in frame budget Check if we're over budget Get queue sizes Get comprehensive statistics Log status report Clear all queues Shutdown scheduler Constants — Template for worker script. Export this and use with URL.createObjectURL. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/scheduler/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


class BrowserRecordContractError extends Error

createBrowserRecordContract({ schema, legacyKey, currentKey = ${legacyKey}.v2, payloadKey = 'value', validate, maxBytes = 4  1024  1024, } = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Shared expand contract owner for structured browser key/value records. Classes Method Signature Summary Functions ${legacyKey}.v2 Constants — Shared expand contract owner for structured browser key/value records. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


class SchemaEvolutionError extends Error

<! 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 Pure registry for explicit schema readers, writers, and migration graphs. It transforms decoded values only and never reads or writes persistence. Method Signature Summary Functions Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/schema/SchemaValidator.js
Classes
class SchemaValidator
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SchemaValidator — Validates game data against JSON schemas. Lightweight validator (no external deps). Checks required fields, types, enums, min/max, and array items. Reports all errors. Classes SchemaValidator — Validates game data against JSON schemas. Lightweight validator (no external deps). Checks required fields, types, enums, min/max, and array items. Reports all errors. Method Signature Summary Register a schema. Validate data against a named schema. Validate and return a cleaned copy with defaults applied. Get all registered schema names <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/schema/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/timing/DisplayRefreshEstimator.js
Classes
class DisplayRefreshEstimator
Functions
createDisplayRefreshEstimator(options)
Notes & Examples

<! 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 Robustly estimates the host display cadence from requestAnimationFrame intervals. Missed callbacks are filtered before estimation, so a busy frame does not incorrectly turn a 144 Hz display into a 72 Hz quality target. Method Signature Summary Functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/timing/FramePacingController.js
Classes
class FramePacingController
Notes & Examples

<! 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 Calculate optimal frame timing Determine if we should skip this frame to maintain pacing Calculate sleep time to hit target frame time Precise frame limiter using busy wait for last millisecond Get frame pacing quality score (0 100) <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/timing/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


core/workers/WorkerPool.js
Classes
class WorkerPool
Notes & Examples

<! 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 Web Worker Pool Multi threaded asset loading and processing Eliminates main thread blocking during heavy operations Method Signature Summary <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


ecs/ComponentHealer.js

healComponent(componentName, data, ctx = new TriangulationContext()

healAndValidate(componentName, data, options = {})

batchHealComponents(components, sharedContext = {})

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ComponentHealer.js Self Healing Data Validation System Implements auto repair for component data using triangulation: Detects missing/invalid/corrupted data Infers correct values from multiple sources (redundancy) Applies intelligent repairs with fallbacks Logs all healing actions for diagnostics Based on self healing system principles: 1. Monitoring & Detection 2. Diagnostics Engine 3. Decision Making Module 4. Execution Framework 5. Knowledge Base (schema defaults + inference rules) 6. Feedback Loop (healing log) Classes Triangulation context provides multiple sources for inferring values Method Signature Summary Get transform for an entity Check if entity exists Get all entity IDs in scene Functions Heal a component using schema and triangulation Parameters: (string) — Name of the component (object) — Component data to heal (TriangulationContext) — Context for triangulation Returns: { data, healed, healedFields } Heal and validate component data before use This is the main entry point for the healing system Get healing statistics with detailed metrics Batch heal multiple components efficiently Parameters: (Array) — Array of {componentName, data, entityId} (object) — Shared context options Returns: Array of healing results Validate component without healing just check for issues Returns: { isValid, issues } <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2


ecs/ComponentHealer.js

by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/EntityManager.js

ecs/EntityManager.js
Functions
deleteEntity(options)
deleteSelectedEntity(ecsState, options)
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 Delete an entity with full cleanup of associated resources. Parameters: (Object) — Deletion options (Object) — ECS world (number) — Entity ID to delete (Array) — Array of spawned entity entries (Map) — Map of entity uniform buffers (Map) — Map of entity bind groups (Object) — Grab state object (optional) (Object) — ECS state object with selectedEntityId and inspectorApi (optional) (Function) — Logger function (optional) Returns: Whether deletion succeeded Delete the currently selected entity. Parameters: (Object) — ECS state with world and selectedEntityId (Object) — Additional options (same as deleteEntity) Returns: Whether deletion succeeded <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark


ecs/EntityManager.js

Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/EntitySchema.js

layersCollide(layerA, maskA, layerB, maskB)

deserializeComponent(componentName, json, healingContext = 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 Normalize a single field value based on its type definition Normalize a component value using its schema definition This is the primary function component files should use Get default values from a schema Helper: Get collision layer mask from layer names Helper: Check if two layer masks collide Helper: Get collision mode flags for PhysX Returns { pairFlags, shapeFlags } for PhysX configuration Register a custom component schema at runtime Allows component files to auto register their schemas Get all registered component schema names Validate and normalize a component value against its schema Create default component data Validate Transform component Validate PhysicsBody component Validate Collider component Validate Light component Validate Camera component Validate Renderable component Validate ParticleEmitter component Validate NavAgent component Validate PhysicsChain component Create default Transform Create default PhysicsBody Create default Collider Create default Light Create default Camera Create default Renderable Create default PhysicsChain Create empty entity Create entity snapshot Create world snapshot JSON replacer function for special values Use with JSON.stringify(obj, jsonReplacer) JSON reviver function for special values Use with JSON.parse(str, jsonReviver) Serialize component to JSON safe object Deserialize component from JSON with optional self healing Parameters: (string) — Component type name (object) — JSON data to deserialize (object) — Optional context for triangulation healing Returns: Deserialized and optionally healed component data Serialize


ecs/EntitySchema.js

(object) — JSON data to deserialize (object) — Optional context for triangulation healing Returns: Deserialized and optionally healed component data Serialize entity snapshot to JSON safe object Serialize world snapshot to JSON safe object Deserialize world snapshot from JSON Interpolate between two vec3 values Interpolate between two quaternions (simple lerp, not slerp) Interpolate Transform between two states Interpolate PhysicsBody between two states Interpolate entity snapshot between two states Get collider shape ID from name Get collider shape name from ID Get light type ID from name Get light type name from ID Get camera projection ID from name Get emitter shape ID from name Constants — Common field types used across components — Transform component schema — PhysicsBody component schema — Collider shapes — Collider component schema — Light types — Light component schema — Camera projection types — Camera modes — Camera component schema — Renderable component schema — Emitter shapes for particle spawning — ParticleEmitter component schema — NavAgent component schema — Chain physics backends — PhysicsChain component schema (unified: particle chains + rigid chains) mode: "particle" = PBD/GPU/PhysX particle chain (formerly PhysicsRope) mode: "rigid" = rigid linked chain (formerly PhysicsChain) — Weld constraint types — WeldConstraint component schema Defines a physics weld between two entities Welds merge collision shapes from child into parent, creating compound bodies. When saved: stores entity IDs and offset When loaded: recreates weld during physics init — Collision modes determines how physics engine handles collisions Maps to PhysX PxPairFlags and shape flags — Predefined collision layers (bitmask) Each entity belongs to one layer (collisionLayer) and can


ecs/EntitySchema.js

handles collisions Maps to PhysX PxPairFlags and shape flags — Predefined collision layers (bitmask) Each entity belongs to one layer (collisionLayer) and can collide with multiple layers (collisionMask) — EntityFlags component schema Unified flags for collision, visibility, and editor behavior This component centralizes all entity interaction flags: Collision: layer/mask filtering, collision mode (solid/trigger/noPush/ghost) Visibility: render visibility, layer masks, editor only visibility Editor: pickable, selectable, locked, hidden in hierarchy Physics: weldable, pushable, sleepable PhysX Integration: collisionLayer → PxFilterData.word0 collisionMask → PxFilterData.word1 collisionMode → PxPairFlags (eSOLVE CONT


ecs/SceneInit.js

ecs/SceneInit.js
Functions
initEcsWorld(options)
createMinimalWorld(options = {})
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 Initialize ECS world with physics sandbox scene. Parameters: (Object) — Initialization options (Object) — ECS state object to populate (Object) — Config state { roomSize, lightHeight, cameraFar } (Object) — Physics state { gravity, staticFriction, dynamicFriction, restitution } (Object) — Render state { lightBrightness } (string) — World name (default: "SimWorld") (number) — Fixed timestep (default: 1/60) (Function) — Optional logger Returns: Created world Create a minimal ECS world without physics sandbox. Parameters: (Object) — Options Returns: Created world <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton


ecs/SceneInit.js

but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/components/Camera.js
Functions
createCamera(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/components/Cloth.js
Functions
createCloth(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/Collider.js
Functions
createCollider(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/ComponentRegistry.js
Functions
defineComponentType(config)
getComponentDefinition(name)
listComponentDefinitions()
getComponentSchema(name)
validateComponentSchema(name, value)
createDefaultFromSchema(name)
Re-exports
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 Get schema for a component from EntitySchema Validate component using EntitySchema Create default component using EntitySchema Re exports , <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/components/FluidSource.js
Functions
createFluidSource(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/FluidVolume.js
Functions
createFluidVolume(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/Input.js
Functions
createInput(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/Light.js
Functions
createLight(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/NavAgent.js
Functions
createNavAgent(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/NetReplicated.js
Functions
createNetReplicated(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/ParticleEmitter.js
Functions
createParticleEmitter(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/ParticleField.js
Functions
createParticleField(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsBody.js
Functions
createPhysicsBody(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsChain.js
Functions
createPhysicsChain(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsCloth.js
Functions
createPhysicsCloth(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsHair.js
Functions
createPhysicsHair(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsRope.js
Functions
createPhysicsRope(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsSoftBody.js
Functions
createPhysicsSoftBody(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/PhysicsWire.js
Functions
createPhysicsWire(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/Renderable.js
Functions
createRenderable(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/StickmanRagdoll.js
Functions
createStickmanRagdoll(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/Transform.js
Functions
createTransform(initial)
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern


ecs/components/TwistedRope.js
Constants
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


createWeld(parentEntityId, childEntityId, 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 new WeldConstraint component Parameters: (Object) — Initial values Returns: WeldConstraint component data Create a weld constraint between two entities Parameters: (number) — Entity that will receive shapes (number) — Entity whose shapes will be transferred (Object) — Additional options Returns: WeldConstraint component data Check if a weld constraint is valid Parameters: (Object) — WeldConstraint component data Returns: True if valid Mark a weld as broken Parameters: (Object) — WeldConstraint component data Returns: Updated weld data Constants <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components


entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/prefabs/PrefabRegistry.js
Functions
registerPrefab(id, definition)
getPrefab(id)
getAllPrefabs()
getPrefabsByCategory(category)
instantiatePrefab(id, overrides = {})
clearPrefabs()
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PrefabRegistry Runtime prefab system for entity templates Prefabs define reusable entity configurations including: Default components Geometry data Collider configuration Visual properties The editor uses spawnables which extend this with spawn UI logic. Runtime uses prefabs directly for instantiation. Functions Register a prefab Parameters: (string) — Unique prefab ID (Object) — Prefab definition Get a prefab by ID Parameters: (string) — Prefab ID Returns: Prefab definition Get all registered prefabs Returns: All prefabs Get prefabs by category Parameters: (string) — Category name Returns: Prefabs in category Instantiate a prefab into components Parameters: (string) — Prefab ID (Object) — Component overrides Returns: Component map ready for entity creation Clear all prefabs (for testing) <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until


queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/prefabs/index.js
Re-exports
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Prefab System Runtime entity templates Re exports , , , , , <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


ecs/query/Query.js
Functions
createQuery(options)
forEachEntity(world, query, callback)
getQueryDebugSnapshot(world, query)
Notes & Examples
ECS Architecture Pattern
ECS Architecture Pattern

<! 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 ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


defineReplicationProfile(name, definition, options = {})

resolveReplicationProfile(name, overrides = {})

createReplicationProjection(netReplicated, components, 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 Constants <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


setEntityComponent(world, entityId, componentName, value)

setEntityComponentDirect(world, entityId, componentName, value)

<! 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 Fast path: update an existing component WITHOUT normalization. Use ONLY when the value is already known valid (e.g., from physics engine output). The entity MUST already have this component — this will NOT add new components. Returns the value if successful, null if entity/component not found. <! HUMAN NOTES Notes & Examples ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities See also: ECS v2 · Engine Architecture ECS Architecture Pattern The Entity Component System (ECS) separates data (Components) from behavior (Systems). Entities are lightweight IDs that group components. Systems query entities by component type and process them in bulk, enabling cache friendly iteration and parallel execution. Example: Creating and querying entities Advanced: Complex queries Advanced: System groups and ordering Advanced: Component events Gotchas: Adding components during iteration : Safe, but new entities won't appear until next frame. Removing entities : Mark for deletion, processed at end of frame to avoid iterator invalidation. Singleton components : Use for global state like Time, Input. See also: ECS v2 · Engine Architecture


registerCameraSystem(world, options = {})


registerClothSystem(world, options = {})


registerFluidDebugSystem(world, options = {})


registerFluidSystem(world, options = {})


registerNavAgentSystem(world, options = {})


registerParticleDebugSystem(world, options = {})


registerParticleSystem(world, options = {})


registerPerceptionSystem(world, options = {})


registerPhysicsSystem(world, options = {})


registerThirdPersonCameraSystem(world, options = {})


registerWorldSystem(world, options = {})


getWorldDebugSnapshot(world, options = {})


createWorldSavePayload(world, options = {})

restoreWorldFromSavePayload(world, payload, options = {})


gameplay/ai/InstinctGraph.js
Classes
class InstinctGraph
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/ai/NPCBrain.js
Classes
class NPCBrain
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: NPCBrain — Tiny JavaScript brain for each NPC. Inputs feed drives. The strongest LEGAL drive wins (RuleGraph filters). Memory changes the weights over time. Drives: fight, flee, protect, steal, obey, betray, comfort, digBuild, follow, reportCrime Classes Method Signature Summary Compute drives for an NPC based on their current state and context. Execute the winning drive's action. Constants — NPCBrain — Tiny JavaScript brain for each NPC. Inputs feed drives. The strongest LEGAL drive wins (RuleGraph filters). Memory changes the weights over time. Drives: fight, flee, protect, steal, obey, betray, comfort, digBuild, follow, reportCrime <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/ai/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/events/EventGraph.js
Classes
class EventGraph
Functions
createEvent(config)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: EventGraph — The event bus and event log for LIFE. Every meaningful thing in the world becomes an event. Events power: memories, dialogue, reputation, crimes, family history, item souls, resolve changes, and storylet triggers. Events are immutable once created. The log is append only. Listeners can subscribe to event types or use wildcard ' '. Classes EventGraph — global event bus + per entity event logs. Method Signature Summary Emit an event. Notifies all matching listeners and stores in logs. Subscribe to events of a given type. Subscribe to the next event of a given type (auto unsubscribes). Unsubscribe a handler from an event type. Query the global event log. Get the event log for a specific entity. Get events at a specific location. Get events with a specific tag. Replay events matching a filter, calling a handler for each. Useful for rebuilding state from event history. Count events matching a filter. Check if any event matching filter exists. Get stats for debugging. Clear all logs and listeners. Use for testing or full reset. Serialize the global log to a plain array (for save). Functions Creates an immutable event object. Parameters: (object) — No description in source JSDoc. (string) — Event type (e.g. 'npc.stole', 'player.born', 'combat.hit') (string) — Entity ID of who caused this event (string) — Entity ID of who this event affects (object) — Arbitrary payload (string) — Where it happened (location ID or coordinates) (string[]) — Entity IDs of who saw it (string[]) — Content tags (hunger, betrayal, family, fear, etc.) (string) — Human readable description Returns: Frozen event object <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a


etc.) (string) — Human readable description Returns: Frozen event object <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/events/index.js
Re-exports
Notes & Examples


gameplay/inventory/Inventory.js
Classes
class Inventory
Functions
defaultResolveEquipSlot(itemData)
createInventory(maxSlots, options)
Constants
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/inventory/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/items/ItemOwnership.js
Classes
class ItemOwnership
Functions
createOwnedItem(config)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: ItemOwnership — Tracks who owns what, detects theft, handles transfers. Classes Method Signature Summary Register an owned item Get item by ID Get all items owned by entity Transfer ownership. Check if a transfer would be theft. Functions Constants — ItemOwnership — Tracks who owns what, detects theft, handles transfers. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/items/ItemSoulSystem.js
Classes
class ItemSoulSystem
Constants
Notes & Examples

<! 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 or get soul data for an item. Record an item event that may advance its soul. Get a whisper from a talking item. Get all items at or above a soul stage. Get all tracked souls Format soul info Constants — ItemSoulSystem — Items slowly gain souls through history. Stages: Normal → Remembered → Resonant → Awakened → Talking → Contract Item Soul growth triggers: named, used often, saved someone, repaired many times, inherited, used in major battles, exposed to domains, part of a contract, emotionally important, connected to death/rescue/betrayal/redemption. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/items/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/BackgroundMatcher.js
Functions
extractOriginTags(text)
mapTagsToOrigin(tagResult)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: BackgroundMatcher — Extracts origin tags from player written background text. The player types a "soul memory" and the system extracts semantic tags that drive world generation: family type, culture, social status, early hardships, resolve seeds, and starting storylets. Uses keyword/phrase matching with weighted scoring. No heavy ML needed for the first playable — just pattern matching with synonyms. Functions Extract origin tags from player written background text. Parameters: (string) — The player's "soul memory" text Returns: { tags: { tag: score }[], topTags: string[], categories: { category: tag[] }, rawScores: { tag: number } } Map extracted tags to world generation parameters. Parameters: (object) — From extractOriginTags() Returns: { familyType, socialStatus, culture, hardships, resolveSeed, startingStorylets, townType } <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/DialogueSystem.js
Classes
class DialogueSystem
Constants
Notes & Examples

<! 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 Generate a dialogue line for an NPC given an intent and context. Get available intents for an NPC given current context. Constants — DialogueSystem — Dynamic narrative template system. Pipeline: event → intent → template → mood → voice layer → relationship tone → final line NPC speech uses templates, not generative AI. The voice layer changes sentence length, glue words, confidence, politeness, swearing, emotional intensity. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! 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 DialogueRunner — Executes a dialogue tree, manages state, and produces UI output. Method Signature Summary Register nodes from a dialogue tree. Get a dialogue variable. Set a dialogue variable. Check if player knows an NPC's name. Start a conversation with an NPC. Returns the first dialogue output (text + choices for player). Player selects a choice. Returns next dialogue output. End current conversation. Queue an NPC to initiate a conversation with the player. Called by NPC brain, storylets, or world director. Check if any NPC wants to initiate conversation. Call each tick. Returns the highest urgency pending initiation, or null. Start an NPC initiated conversation. NPC speaks first, player responds. Build player response choices for NPC initiated conversations. Detect nearby NPCs who can overhear the conversation. They may react, interject, or remember what was said. Get eavesdropper reactions to a conversation choice. Some NPCs may interject if the topic affects them. Check if a specific NPC wants to interject into the active conversation. Returns an interjection or null. Functions Create a dialogue node. Shorthand builders. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/LifePhases.js
Classes
class LifePhases
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: LifePhases — Controls the origin sequence: birth → childhood → crisis → youth → main game. Each phase runs a sequence of events and storylets, then transitions to the next. The player watches/interacts through text during early phases, then gains full control at Youth. Classes Method Signature Summary Register a phase change listener. Register a narrative text listener (for UI display). Start the origin sequence with generated origin data. Advance to the next phase (called by UI when player clicks "continue"). Constants — LifePhases — Controls the origin sequence: birth → childhood → crisis → youth → main game. Each phase runs a sequence of events and storylets, then transitions to the next. The player watches/interacts through text during early phases, then gains full control at Youth. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/OriginGenerator.js
Functions
generateOrigin(origin, suggestedName)
Notes & Examples

<! 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 Generate a full origin from mapped tags. Parameters: (object) — From mapTagsToOrigin() (string) — Player's suggested name Returns: Full origin data <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/SituationGraph.js
Classes
class SituationGraph
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SituationGraph — Selects life pressure situations for the player. Situation buckets: family, survival, crime, faction, power, exploration, social, build/dig, item soul, law, domain, revenge, redemption. Chooses situations based on player background, family state, location, NPC relationships, faction reputation, active crimes, wealth, danger, resolve path, recent failures/victories. Classes Method Signature Summary Evaluate which situation bucket should be active based on world state. Get current state for debugging Constants — SituationGraph — Selects life pressure situations for the player. Situation buckets: family, survival, crime, faction, power, exploration, social, build/dig, item soul, law, domain, revenge, redemption. Chooses situations based on player background, family state, location, NPC relationships, faction reputation, active crimes, wealth, danger, resolve path, recent failures/victories. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/StoryGraph.js
Classes
class StoryGraph
Functions
createStorylet(config)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: StoryGraph — Storylet engine for LIFE. Stories are storylets, not one fixed script. A storylet is a small reusable story event that triggers when conditions are true. Each storylet has: trigger conditions, cast, stakes, choices, consequences, memories, and graph updates. Classes Method Signature Summary Register a storylet. Register multiple storylets at once. Check all storylets and fire the best eligible one. Force fire a specific storylet (for testing / debug). Get all registered storylet IDs and names. Get count of registered storylets Clear all storylets Functions Create a storylet definition. Parameters: (object) — No description in source JSDoc. (string) — Unique storylet ID (string) — Human readable name (string[]) — Content tags (function) — (worldState) = boolean (function) — (worldState, cast) = { narrative, consequences, memories } (function) — (worldState) = object — pick NPCs to fill roles (number) — =60000] Min ms between fires (number) — =5] Higher = checked first (number) — =0] 0 = unlimited (string) — No description in source JSDoc. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/WorldDirector.js
Classes
class WorldDirector
Constants
Notes & Examples

<! 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 Evaluate world state and potentially fire a director event. Call every tick — internally throttles to checkInterval. Get current director state for debugging. Constants — WorldDirector — Controls pacing and selects world events. Watches: player stress, supplies, family conflict, recent fights, deaths, victories, crew size, base strength, faction anger, unresolved crimes, resolve growth, domain activity. Selects events to create: pressure → relief → pressure → consequence. Not constant chaos. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/narrative/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Core Storylet Library — Initial content for the StoryGraph. Each storylet has trigger conditions, cast selection, and execution logic. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/perception/PerceptionGraph.js
Classes
class PerceptionGraph
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: PerceptionGraph — Controls what the player can perceive about NPCs. NPCs have hidden truth. The player sees tags based on perception skill, distance, lighting, relationship, NPC deception, disguise, and domain effects. Tags can be WRONG if the NPC is good at hiding. Classes Method Signature Summary Get perception tags for a target entity from the player's perspective. Get perception tags for ALL nearby entities. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/perception/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/progression/ContractSystem.js
Classes
class ContractSystem
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/progression/DomainGraph.js
Classes
class DomainGraph
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: DomainGraph — Local rule overrides. A domain is a personal law forced onto an area. Domains are rare and earned. They modify rules within a radius, cost stamina/resolve to maintain, and have weaknesses and failure conditions. Domain rules are priority 8 in RuleGraph — they can override local reality but not engine safety or physics. Classes Method Signature Summary Check if an entity qualifies to activate a domain. Activate a domain for an entity. Deactivate a domain (expired, failure, or manual). Update all active domains — check expiry, failure conditions, cost. Call every tick. Check if a world position is inside any active domain. Get all active domains. Format domain info as text. Clear all domains <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/progression/PowerGraph.js
Classes
class PowerGraph
Functions
createPower(config)
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/progression/ResolveSystem.js
Classes
class ResolveSystem
Notes & Examples


gameplay/progression/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/rules/RuleGraph.js
Classes
class RuleGraph
Functions
createRule(config)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: RuleGraph — The master rule resolver for LIFE. Everything in the world passes through RuleGraph to decide what is legal. Rules have priorities (1=highest), conditions, effects, and sources. When rules conflict, the highest priority wins. Ties break by specificity. Priority levels: 1 = Engine safety (cannot crash the game) 2 = Physics / material (fire burns wood) 3 = Survival / body (hunger kills) 4 = World rules (gravity, time) 5 = Law / faction (city forbids theft) 6 = Item rules (sword needs two hands) 7 = Contract rules (guardian vow restricts solo fighting) 8 = Domain rules (domain overrides local reality) 9 = Temporary status / visual (buff, aura, particle effect) Classes RuleGraph — singleton style rule management and resolution. Method Signature Summary Register a rule. Remove a rule by ID. Remove all rules from a specific source. Get a rule by ID. Remove expired rules. Call periodically. Query: Is this action allowed given the current context? Gathers all matching rules, sorts by priority (ascending = higher priority first), then by specificity (descending), and resolves conflicts. Query: What result does an action produce after all modify/replace rules? Runs the action through all matching MODIFY and REPLACE rules in priority order. Explain why a specific action would be allowed or denied. Returns a human readable explanation chain. Get all active rules matching a filter. Get the trace log from the most recent isAllowed() or resolve() call. Get total number of registered rules. Get stats for debugging. Remove all rules. Use for testing or full reset. Serialize all rules to a plain array (for save/debug). Note: condition and apply functions are NOT serializable — only


rules. Use for testing or full reset. Serialize all rules to a plain array (for save/debug). Note: condition and apply functions are NOT serializable — only metadata is saved. Functions Creates a new rule object. Parameters: (object) — No description in source JSDoc. (string) — Human readable rule name (string) — One of RuleCategory values (string) — Who/what created this rule (entity id, system name, etc.) (string) — One of RuleEffect values (function) — (action, context) = boolean — when does this rule apply? (function ) — (action, context) = result — what happens when rule fires (string[]) — Content tags for filtering (number) — Higher = more specific (breaks ties within same priority) (number) — Timestamp when rule expires, null for permanent (string) — Human readable explanation Returns: Frozen rule object Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/rules/index.js
Re-exports
Notes & Examples


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SimulationManager — Controls simulation levels for all entities. Active: Near player — full behavior, every tick Warm: Same town — slower updates, simplified drives Cold: Far away — daily summary simulation Frozen: No updates until touched by event Transition triggers: player proximity, event targeting, faction actions. Classes Method Signature Summary Update simulation levels based on player position, then tick active/warm entities. Force wake an entity (e.g. when an event targets it). Get simulation stats. Constants — SimulationManager — Controls simulation levels for all entities. Active: Near player — full behavior, every tick Warm: Same town — slower updates, simplified drives Cold: Far away — daily summary simulation Frozen: No updates until touched by event Transition triggers: player proximity, event targeting, faction actions. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/simulation/index.js
Re-exports
Notes & Examples


gameplay/social/SoulGraph.js
Classes
class SoulGraph
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SoulGraph — The social nervous system of the world. Each NPC is a "neuron" node. Relationships are weighted edges. Events are signals. Mood is activation state. Memory is weight change. Actions are outputs. The graph propagates influence through connections. NPC = soul node Relationship = weighted edge (trust, fear, love, hate, loyalty, resentment, familiarity) Event = signal Mood = activation state Memory = weight change Action = output Classes SoulGraph — The social nervous system of the world. Each NPC is a "neuron" node. Relationships are weighted edges. Events are signals. Mood is activation state. Memory is weight change. Actions are outputs. The graph propagates influence through connections. NPC = soul node Relationship = weighted edge (trust, fear, love, hate, loyalty, resentment, familiarity) Event = signal Mood = activation state Memory = weight change Action = output Method Signature Summary Get all relationship edges for an entity, with computed influence scores. Propagate a social signal through the graph. When an event affects an entity, connected entities react based on their relationship. Find the strongest connection paths between two entities (up to 3 hops). Get the "social temperature" of an entity — how much social pressure they're under. <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/social/SoulGraphMessaging.js
Classes
class SoulGraphMessaging
Functions
createMessage(config)
Constants
Notes & Examples

<! 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 Send a message. It enters the pending queue for propagation. Process all pending messages — deliver and propagate. Call this once per game tick or every N ticks. Get delivered message log. Get pending message count. Clear all pending and delivered Functions Create a message. Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/social/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/society/CitySystem.js
Classes
class CitySystem
Functions
createCity(config)
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: CitySystem — City templates, population, economy, laws, reputation. Classes Method Signature Summary Add entity to city population Remove entity from city population Get city reputation toward an entity Modify city reputation Get city by name Functions <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/society/FactionGraph.js
Classes
class FactionGraph
Functions
createFaction(config)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: FactionGraph — Group souls with politics, reputation, and actions. Factions track: leader, values, laws, territory, resources, enemies/allies, fear, morale, population, reputation toward player, domain users, crimes, contracts. Classes Method Signature Summary Register a faction Get faction by ID Get all factions Get reputation of an entity with a faction. Modify reputation. Record a crime against a faction. Determine what action a faction would take toward an entity. Get relationship between two factions. Set relationship between two factions. Get count Clear Functions Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/society/LawGraph.js
Classes
class LawGraph
Functions
createCrimeRecord(config)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: LawGraph — Crime, witnesses, punishment, and justice. Different cities and factions have different laws. Tracks: witnesses, evidence, suspicion, reputation. Punishment: bounty, exile, prison, revenge, retaliation. Classes Method Signature Summary Define laws for a location or faction. Report a crime. Creates a record, notifies witnesses, adjusts suspicion. Check suspicion level for an entity. Check if an entity is wanted (suspicion threshold). Get all unresolved crimes by a perpetrator. Get all unresolved crimes at a location. Resolve a crime (punished, forgiven, etc.). Decay suspicion over time. Call periodically. Get total crime count Get unresolved count Clear Functions Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/society/index.js
Re-exports
Notes & Examples

<! 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 No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/spells/SpellElementMixer.js
Classes
class SpellElementMixer
Functions
getSpellElementMixer()
mixElements(element1, element2)
mixMultipleElements(elements)
Constants
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SpellElementMixer.js Element Combination System Handles mixing two or more elements to create combined/hybrid elements: Fire + Ice = Steam Fire + Nature = Ash Lightning + Water = Electrified etc. Combined elements have unique visual effects and status effects. Classes Method Signature Summary Build combination lookup cache Mix two elements Enhance a single element (double casting) Create a generic blend for undefined combinations Mix multiple elements (3+) Get all possible combinations for an element Get all available combinations Check if two elements can combine Get combination info without creating Functions Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SpellGenerator.js Procedural Spell Creation System Generates complete spells from parameters: Element (Fire, Ice, Lightning, Arcane, Nature, Dark, Holy) Type (Projectile, AOE, Beam, Shield, Buff, Summon) Modifiers (Homing, Piercing, Explosive, Chain, etc.) Power level for stat scaling Outputs: Visual effect (uses CustomParticleEffect SDF) Collision shape (same SDF as visual) Particle emitter config Game stats (damage, mana cost, cooldown) Sound effect hints MULTIPLAYER: All generation is deterministic via seeded RNG. Never use Math.random() or Date.now() for gameplay affecting values. Classes Method Signature Summary Create seeded RNG Generate a complete spell from parameters Calculate spell stats Generate particle effect configuration Generate SDF code based on spell type Generate color code based on element Generate emitter configuration Generate spell name Random choice helper Generate a random spell Generate a set of spells (e.g., for loot) Functions Serialize spell to minimal format for network transmission Only includes data needed to regenerate the spell deterministically Deserialize spell from network format Regenerates full spell from minimal data Validate spell data matches seed (anti cheat) Returns true if spell stats match what seed would generate Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


writeGeneratedSpellLibraryRecord(library, storage = globalThis.localStorage)

async saveGeneratedSpell(generatedSpell, storage = globalThis.localStorage)

deleteGeneratedSpell(id, storage = globalThis.localStorage)

createEmitterFromGeneratedSpell(generatedSpell, options = {})

quickGenerateSpell(element, type, powerLevel = 1.0)

generateCombinedSpell(element1, element2, type, powerLevel = 1.0)

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: SpellGeneratorIntegration.js Connect SpellGenerator to existing SpellConfig Bridges the procedural spell generator with the existing spell system: Converts generated spells to SpellConfig format Integrates with SpellEffectFactory for particle emitters Provides save/load for generated spells Functions Convert a generated spell to the existing SpellConfig format Compatible with SpellConfig.js SPELL PRESETS structure Convert existing SpellConfig preset to generator format Allows editing existing spells in the generator Save generated spell to library (IndexedDB via registry pattern) Load spell library from storage Get a generated spell by ID Delete a generated spell Get all generated spells as array Create particle emitter config from generated spell For use with SpellEffectFactory IMPORTANT: Physics parameters (mass, drag, bounciness, collisionEnabled) are included to ensure collision behavior matches visual expectations. The effectId links to the SAME SDF used for both rendering AND collision. Quick generate a spell with minimal parameters Generate a combined element spell Generate loot style random spell Constants <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.


gameplay/spells/index.js
Re-exports
Notes & Examples

<! AUTOGENERATED by tools/extract api.py — content above HUMAN NOTES is overwritten Source: Spell System Exports Barrel file for easy importing of all spell related modules. Re exports , , , , , , , , , , , , , , , , , , , , , , , , , <! HUMAN NOTES Notes & Examples No hand authored notes yet. Add page notes in or a reusable block in — see API Reference Standard.