9. Simulator & Sandbox Environments

menu_book Spatioz Engine — Technical Reference

Simulator & Sandbox Environments

To quickly test configurations, Spatioz includes a lightweight Simulator & Sandbox Environment. The sandbox runs entirely inside the browser or through a node console, allowing real-time visualization of tension fields.


1. Sandbox Architecture

The sandbox provides three core tools:

  1. Interactive Vector Canvas: Renders agent trajectories, targets, obstacles, and tension fields as color-coded vectors.
  2. YAML Editor & Live Reloader: Allows editing configuration parameters and watching the behavior change instantly without restarting the simulation.
  3. Telemetry Console: Graphs the valences and output signals in real-time, highlighting near-deadlock and maximum tension states.
+-------------------------------------------------------------+
|                     Spatioz Simulator                       |
+--------------------------+----------------------------------+
|                          |  YAML Config Editor              |
|   (Dynamic Canvas)       |  nodes:                          |
|    Agent --> Target      |    attraction: [0.0, 1.0...]     |
|   [Tension Fields]       |                                  |
|                          +----------------------------------+
|                          |  Live Telemetry                  |
|                          |  Tension: [================-]    |
+--------------------------+----------------------------------+

2. Using the Simulation API

To launch a simulation programmatically, import Simulation and bind it to a canvas element:

import { Simulation, RelationalKernel } from 'spatioz';

// Initialize the kernel
const kernel = new RelationalKernel(yamlConfig);

// Create the simulation loop
const sim = new Simulation({
  canvas: document.getElementById('sandbox-canvas'),
  kernel: kernel,
  fps: 60
});

// Start the loop
sim.start();

The simulator features a Time Dilation Factor parameter, allowing you to slow down the tension propagation solver to frame-by-frame resolutions to analyze complex collisions.