Members
(constant) ABILITY_NODE_VOCABULARY
Fixed node vocabulary supported by the Larissa ability composition runtime.
(constant) ARCHETYPES
Built-in archetype profiles with configured perception and memory budgets.
(constant) AUTHORED_UI_VERSION
Small, declarative HTML UI layer for scene data. This is intentionally a safe subset: no HTML strings, CSS strings, scripts, or arbitrary URLs.
- Source
(constant) BUILTIN_MATERIALS
Standard built-in material definitions.
- Source
(constant) CollisionLayers
Built-in standard collision layer flags for 2D bitmask filtering.
- Source
(constant) EQUIPMENT_SLOTS :Array.<string>
Designated equipment slots supported by the equipment system.
- Array.<string>
- Source
(constant) FACTION_DISPOSITION
Standard faction dispositions.
- Source
(constant) FALLBACK_MATERIAL
Fallback material used when an unknown material is queried.
- Source
(constant) InteractionType
Interaction types applicable to materials.
- Source
(constant) MaterialState
Standard material interaction states.
- Source
(constant) ROUTINE_ACTIVITIES
Standard routine activity types supported by NPC schedules.
- Source
(constant) SEMANTIC_LAYER_TYPES
Standard semantic tile types for world definitions
- Source
(constant) UtilityCurves
Common normalized consideration curve functions mapping [0, 1] input to [0, 1] output.
- Source
Methods
applyEffects(effects, facts)
Applies consequences/effects to WorldFacts.
| Name | Type | Description |
|---|---|---|
effects | Object | | |
facts | WorldFacts |
- Source
assertResourceReference()
Validate a serialized resource reference without checking the filesystem.
- Source
boxColliderToCollider()
Adapt the engine's legacy BoxCollider dimensions to Nereid's overlap contract.
canLayersCollide(layerA, maskA, layerB, maskB, optionsopt) → {boolean}
Checks whether two collision layers/masks match according to symmetric or asymmetric rules. In symmetric mode, both A must mask B and B must mask A. In asymmetric mode, evaluates whether candidate A detects candidate B: (maskA & layerB) !== 0.
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
layerA | number | ||||||||||||
maskA | number | ||||||||||||
layerB | number | ||||||||||||
maskB | number | ||||||||||||
options | Object | <optional> | Properties
|
- Source
- Type:
- boolean
clamp01(value) → {number}
Clamps a number to the [0, 1] range.
| Name | Type | Description |
|---|---|---|
value | number | Numeric value to clamp. |
- Source
Clamped value between 0 and 1.
- Type:
- number
collectRenderableRoots()
Collect top-level renderables, descending through non-renderable layer entities.
- Source
createCollisionMask(…layers) → {number}
Create a bitmask from multiple layer bit flags.
| Name | Type | Attributes | Description |
|---|---|---|---|
layers | number | <repeatable> |
- Source
- Type:
- number
createDefaultActions(optionsopt) → {Array.<UtilityAction>}
Creates built-in candidate action templates: attack, flee, heal, patrol, rest.
| Name | Type | Attributes | Description |
|---|---|---|---|
options | Object | <optional> | Optional overrides. |
- Source
Array of candidate actions.
- Type:
- Array.<UtilityAction>
createHTMLUIClient()
Build the browser-side HTML UI client, exposing only explicitly allowed actions.
- Source
createRPGSnapshot(context) → {Object}
Helper to create a unified snapshot for inventory, equipment, and currency.
| Name | Type | Description |
|---|---|---|
context | Object |
- Source
- Type:
- Object
createUIBridge(options) → {Object}
Create a typed, serializable event bridge between the game runtime and an HTML UI. Events use { type: 'neptune:ui', version: 1, direction, name, payload }.
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | Properties
|
- Source
- Type:
- Object
deepFreeze(value) → {Object}
Deep-freeze a plain object or array to ensure immutability.
| Name | Type | Description |
|---|---|---|
value | Object |
- Source
- Type:
- Object
detectContradictions(conditions) → {Array.<{fact: string, message: string}>}
Detects logical contradictions in a set of conditions.
| Name | Type | Description |
|---|---|---|
conditions | Array | |
- Source
- Type:
- Array.<{fact: string, message: string}>
evaluateConditions(conditions, facts, contextopt) → {boolean}
Evaluates conditions against WorldFacts. Supports single condition or array (AND).
| Name | Type | Attributes | Description |
|---|---|---|---|
conditions | Object | | ||
facts | WorldFacts | ||
context | Object | <optional> |
- Source
- Type:
- boolean
evaluateSingleCondition(condition, facts, contextopt) → {boolean}
Evaluates a single condition against WorldFacts.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
condition | Object | | |||
facts | WorldFacts | |||
context | Object | <optional> | null |
- Source
- Type:
- boolean
exponential(x, exponentopt) → {number}
Exponential response: f(x) = x^exponent.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x | number | Normalized input. | ||
exponent | number | <optional> | 2 | Power exponent. |
- Source
- Type:
- number
extractCanHeal(context) → {boolean}
Checks whether healing resource is available.
| Name | Type | Description |
|---|---|---|
context | Object | Game context. |
- Source
True if healing resource or ability is available.
- Type:
- boolean
extractDangerLevel(context) → {number}
Safely extracts danger/threat level (0..1) from context.
| Name | Type | Description |
|---|---|---|
context | Object | Game context. |
- Source
Danger level between 0 and 1.
- Type:
- number
extractFacing(obj) → {number}
Safely extracts facing angle in radians from an observer.
| Name | Type | Description |
|---|---|---|
obj | Object |
- Type:
- number
extractHealthFraction(context) → {number}
Safely extracts normalized health fraction (0..1) from context.
| Name | Type | Description |
|---|---|---|
context | Object | Game context. |
- Source
Health fraction between 0 and 1.
- Type:
- number
extractPosition(obj) → {Object|null}
Safely extracts a 2D coordinate from an object, component, or entity.
| Name | Type | Description |
|---|---|---|
obj | Object |
- Type:
- Object |
null
extractRangeScore(context) → {number}
Safely extracts target range suitability score (0..1).
| Name | Type | Description |
|---|---|---|
context | Object | Game context. |
- Source
Range score between 0 and 1.
- Type:
- number
extractStaminaFraction(context) → {number}
Safely extracts stamina/energy fraction (0..1) from context.
| Name | Type | Description |
|---|---|---|
context | Object | Game context. |
- Source
Stamina fraction between 0 and 1.
- Type:
- number
finiteNumber(value, name) → {number}
Validates finite number.
| Name | Type | Description |
|---|---|---|
value | number | |
name | string |
- Source
- Type:
- number
finiteNumber(value, name, minopt) → {number}
Validates that a value is a finite number greater than or equal to a minimum.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value | number | |||
name | string | |||
min | number | <optional> | 0 |
- Type:
- number
finiteNumber(value, name) → {number}
Validates finite number.
| Name | Type | Description |
|---|---|---|
value | number | |
name | string |
- Source
- Type:
- number
finiteNumber(value, name) → {number}
Validates finite number.
| Name | Type | Description |
|---|---|---|
value | number | |
name | string |
- Source
- Type:
- number
finiteNumber(value, name, minopt) → {number}
Validates finite number.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value | number | |||
name | string | |||
min | number | <optional> | 0 |
- Source
- Type:
- number
getActorPosition(actor) → {Object}
Helper to get 2D position from an actor or position object.
| Name | Type | Description |
|---|---|---|
actor | Object |
- Type:
- Object
getNested(obj, parts) → {any}
Safely traverses an object along path segments.
| Name | Type | Description |
|---|---|---|
obj | object | |
parts | Array.<string> |
- Source
- Type:
- any
getNode(abilityDef, nodeId) → {Object|null}
Lookup a node in ability definition nodes by id. Supports both Map/Object map and Array schemas.
| Name | Type | Description |
|---|---|---|
abilityDef | Object | |
nodeId | string |
- Type:
- Object |
null
getOutgoingEdges(node) → {Array.<{targetId: string, field: string}>}
Returns all outgoing reference edges from a node for flow & cycle tracking.
| Name | Type | Description |
|---|---|---|
node | Object |
- Type:
- Array.<{targetId: string, field: string}>
getPointKey(point) → {string|null}
Derives a string identifier for a destination point or object.
| Name | Type | Description |
|---|---|---|
point | Object | | Destination point. |
- Source
String key or null if invalid.
- Type:
- string |
null
getResourceReferenceTarget()
Return the usable string target from a serialized reference.
- Source
installHTMLUI()
Create a ready-to-use window.neptuneUI client for an embedded HTML interface.
- Source
installUINavigation(root, options) → {function}
Attach focus-based keyboard/controller navigation to a UI root. The injected adapter can translate gamepad buttons to the same directional commands.
| Name | Type | Description |
|---|---|---|
root | Element | |
options | Object | Navigation callbacks and optional controller adapter. |
- Source
cleanup callback
- Type:
- function
inverseLinear(x) → {number}
Inverse linear response: f(x) = 1 - x.
| Name | Type | Description |
|---|---|---|
x | number | Normalized input. |
- Source
- Type:
- number
inverseQuadratic(x) → {number}
Inverse quadratic response: f(x) = (1 - x)^2.
| Name | Type | Description |
|---|---|---|
x | number | Normalized input. |
- Source
- Type:
- number
inverseStep(x, thresholdopt) → {number}
Inverse binary step threshold response: 1 if x < threshold, else 0.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x | number | Normalized input. | ||
threshold | number | <optional> | 0.5 | Cutoff threshold. |
- Source
- Type:
- number
isActorAlive(actor) → {boolean}
Helper to check whether an actor is alive.
| Name | Type | Description |
|---|---|---|
actor | Object |
- Type:
- boolean
isDestroyed(entity) → {boolean}
Determines whether an entity has been destroyed or flagged as dead.
| Name | Type | Description |
|---|---|---|
entity | Object |
- Type:
- boolean
isEntityActive()
Whether this entity and every ancestor are enabled for runtime processing.
- Source
isHourInSlot(hour, start, end) → {boolean}
Checks whether a given hour falls inside a slot with optional midnight wraparound.
| Name | Type | Description |
|---|---|---|
hour | number | Hour to test [0, 24). |
start | number | Slot start hour [0, 24). |
end | number | Slot end hour [0, 24). |
- Source
True if the hour falls within the slot interval.
- Type:
- boolean
isValidEquipmentSlot(slot) → {boolean}
Validate that an equipment slot name is one of the designated slots.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- boolean
linear(x) → {number}
Linear identity response: f(x) = x.
| Name | Type | Description |
|---|---|---|
x | number | Normalized input. |
- Source
- Type:
- number
logistic(x, steepnessopt, midpointopt) → {number}
Logistic (sigmoidal) S-curve response.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x | number | Normalized input. | ||
steepness | number | <optional> | 10 | Curve steepness factor. |
midpoint | number | <optional> | 0.5 | Inflection midpoint. |
- Source
- Type:
- number
matchesPattern(pattern, key) → {boolean}
Matches a key against a pattern with wildcard support.
| Name | Type | Description |
|---|---|---|
pattern | string | | |
key | string |
- Source
- Type:
- boolean
mountAuthoredUI()
Mount versioned authored UI. Preview mode never runs gameplay actions.
- Source
nonEmptyString(value, name) → {string}
Validates non-empty string.
| Name | Type | Description |
|---|---|---|
value | string | |
name | string |
- Source
- Type:
- string
nonEmptyString(value, name) → {string}
Validates that a value is a non-empty string.
| Name | Type | Description |
|---|---|---|
value | string | |
name | string |
- Type:
- string
nonEmptyString(value, name) → {string}
Validates non-empty string.
| Name | Type | Description |
|---|---|---|
value | string | |
name | string |
- Source
- Type:
- string
normalizeAngle(angle) → {number}
Helper to normalize an angle between -PI and PI.
| Name | Type | Description |
|---|---|---|
angle | number |
- Type:
- number
normalizeAngle(rad) → {number}
Normalize an angle into [-PI, PI].
| Name | Type | Description |
|---|---|---|
rad | number |
- Type:
- number
normalizeCellData(data, defaults) → {object}
Normalizes cell coordinates and data.
| Name | Type | Description |
|---|---|---|
data | string | | Material ID or partial cell data. |
defaults | object | Default configuration values. |
- Source
Normalized cell state object.
- Type:
- object
normalizeProvenance(provenance) → {Object}
Normalizes provenance metadata.
| Name | Type | Description |
|---|---|---|
provenance | string | |
- Source
- Type:
- Object
parseHour(time) → {number}
Normalizes and parses a game hour into a 24-hour float [0, 24). Supports numbers, strings like "14:30" or "06:00", or GameClock instances.
| Name | Type | Description |
|---|---|---|
time | number | | The time value to parse. |
- Source
Normalized hour from 0 up to (exclusive) 24.
- Type:
- number
quadratic(x) → {number}
Quadratic response (accelerating / ease-in): f(x) = x^2.
| Name | Type | Description |
|---|---|---|
x | number | Normalized input. |
- Source
- Type:
- number
rayIntersectsObstacle(p1, p2, obstacle) → {boolean}
Checks whether a line segment from p1 to p2 intersects an obstacle.
| Name | Type | Description |
|---|---|---|
p1 | Object | |
p2 | Object | |
obstacle | Object |
- Type:
- boolean
restoreRPGSnapshot(snapshot, context) → {boolean}
Helper to restore a unified snapshot for inventory, equipment, and currency.
| Name | Type | Description |
|---|---|---|
snapshot | Object | |
context | Object |
- Source
- Type:
- boolean
segmentIntersectsAABB(p1, p2, left, top, right, bottom) → {boolean}
Tests ray segment intersection against an axis-aligned bounding box.
| Name | Type | Description |
|---|---|---|
p1 | Object | |
p2 | Object | |
left | number | |
top | number | |
right | number | |
bottom | number |
- Type:
- boolean
segmentIntersectsCircle(p1, p2, cx, cy, radius) → {boolean}
Tests ray segment intersection against a circle obstacle.
| Name | Type | Description |
|---|---|---|
p1 | Object | |
p2 | Object | |
cx | number | |
cy | number | |
radius | number |
- Type:
- boolean
segmentIntersectsSegment(p1, p2, p3, p4) → {boolean}
Tests 2D line segment intersection.
| Name | Type | Description |
|---|---|---|
p1 | Object | |
p2 | Object | |
p3 | Object | |
p4 | Object |
- Type:
- boolean
setNested(obj, parts, value)
Sets a nested property on an object, creating intermediate objects as needed.
| Name | Type | Description |
|---|---|---|
obj | object | |
parts | Array.<string> | |
value | any |
- Source
smoothstep(x) → {number}
Smoothstep curve (Hermite interpolation): f(x) = 3x^2 - 2x^3.
| Name | Type | Description |
|---|---|---|
x | number | Normalized input. |
- Source
- Type:
- number
sortRenderables()
Stable scene-local sort: finite renderOrder first, then original traversal order.
- Source
step(x, thresholdopt) → {number}
Binary step threshold response: 1 if x >= threshold, else 0.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x | number | Normalized input. | ||
threshold | number | <optional> | 0.5 | Activation threshold. |
- Source
- Type:
- number
validateMaterialDefinition(id, def) → {object}
Validates a material definition object.
| Name | Type | Description |
|---|---|---|
id | string | The material ID. |
def | object | The material definition. |
- Source
Normalized and frozen material definition.
- Type:
- object
validateSceneResourceReferences()
Validate resource references in a serialized scene before instantiation.
- Source
Type Definitions
Item
Item definition.
- Object
| Name | Type | Description |
|---|---|---|
id | string | Unique item ID. |
name | string | Display name. |
type | string | Item type (consumable, weapon, armor, key). |
value | number | Sell value. |
stats | Object | Stat modifiers when equipped. |
stackable | number | Max stack size (1 for non-stackable). |
- Source