Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Diagnostic code · ARA0200

Non-deterministic simulation code

Code in a [Simulation] type or assembly depends on ambient state or scheduling. Identical inputs must produce identical fixed-tick results for prediction and replay. The edit is rejected; the last good code keeps running.

Common causes

  • Reading wall-clock time, calling Guid.NewGuid, using System.Random, or accessing I/O.
  • Using async, await, tasks, threads or timers in simulation code.
  • A lambda in a simulation command captures state.

Fixes

  • Use the supplied Tick and its fixed Dt, and the context RNG (ref Rng in a query), with authoritative state stored in ECS components or resources.

  • Move I/O and asynchronous work outside simulation and pass their results through explicit inputs or commands.

  • Make command lambdas non-capturing and pass required values explicitly.

  • Code: ARA0200

  • Constant: cs::NON_DETERMINISM

  • Reported by: Ara.Analyzers