Skip to content

Engine → Scripting

script_runtime.h

The native side of script execution. One script_runtime per process (asserted; script_runtime::active() is what the component hooks and the core table entries reach). It owns the host, the class registry, the store, the frame block, the pending queues and the DOD query scopes; attach_world() wires the ADDED/REMOVED observers of script_component and of the activity tags (set_activity_tags). Every method runs on the main thread.

Structs

File Description
collision_event One contact the engine forwards from physics_world::contact_events(); dispatched to both participants' scripts with the normal flipped for b.
managed_memory_delta The managed heap figures of one frame (script_runtime::sample_managed_memory). allocatedBytes and the collections are what happened since the previous sample on the main thread's managed heap; heapBytes is the heap size now. Threads that scripts start are not counted.
script_runtime::deferred_reservation An id the scripting entries reserved through mDeferredCommands that no flush has applied yet. held follows the components the commands recorded so far give it, so component_remove can answer whether there is something to remove; an instantiation root gets its archive's components at the flush, which the runtime cannot see (heldKnown false).
script_runtime::faulted_slot A fault reported inside create_instances, before its slot was mapped (OnCreate or OnReload threw).
script_runtime::pending_create
script_runtime::query_cache_key The component ids a scope requires (with) and excludes (without), each sorted ascending, without repeats and padded with component_id::INVALID: the same sets in any order, {a, a} included, find the same cached query (columns still follow the request order), and {a} without {b} is a different query from {a}.
script_runtime::query_scope_state
script_runtime_config
script_runtime_stats Snapshot of the runtime's size for diagnostics and tests.

Classes

File Description
script_runtime

Enumerations

script_mode

enum class script_mode : u8 {
    EDIT,       // JSON is authoritative, no managed instances exist
    PLAY        // live instances are authoritative, JSON is a snapshot
};

Functions

Public

fill_core_native_entries

CONJURE_API void fill_core_native_entries(
    conjure_native_api &api) noexcept;

Fills the core-owned entries (log_*, script_*, the five entity_*, component_*, query_*) of a table with functions that act on script_runtime::active(). Called by script_runtime::initialise.