Quantum 3
3.1.0
Creates and steps a single verified Frame without a QuantumGame or a DeterministicSession, running only the systems passed in Args.Systems. Meant for tests, benchmarks and tools. More...
Inherits IDisposable.
Classes | |
| struct | Args |
| The FrameEmulator creation arguments. More... | |
Public Member Functions | |
| FrameEmulator (in Args args) | |
| Creates the frame context and the frame and initializes the systems. More... | |
| void | AddCommand (PlayerRef player, DeterministicCommand command) |
| Adds a command of a player to the next step. The emulator takes the ownership of the command. More... | |
| void | AddPlayer (PlayerRef player, RuntimePlayer data) |
| Marks the player as present (connected) and sets its runtime player data during the next step, which raises ISignalOnPlayerAdded. The actor id of the player is its index + 1. More... | |
| T | CreateAndAddAsset< T > (Action< T > init=null) |
| Creates an asset, invokes the optional action and adds the asset to the resource manager. If the action does not set a valid guid, the next free one starting at DefaultAssetGuids.Max is assigned. More... | |
| void | Dispose () |
| Frees the frame, disposes the frame context and unloads the assets of the emulator's resource manager. More... | |
| void | RemovePlayer (PlayerRef player) |
| Marks the player as not present (disconnected) and raises ISignalOnPlayerRemoved during the next step. Like in a session, the runtime player data is kept. Cancels an AddPlayer that was not stepped yet. More... | |
| void | SetInput (PlayerRef player, Input input) |
| Sets the input of a player. The input is kept for all following steps until it is set again. More... | |
| void | Step (Int32 ticks=1) |
| Emulates ticks ticks. More... | |
Static Public Member Functions | |
| static FrameEmulator | Create (Map map, params SystemBase[] systems) |
| Creates an emulator with map that runs systems with the config from CreateSimulationConfig. More... | |
| static FrameEmulator | Create (params SystemBase[] systems) |
| Creates an emulator without a map that runs systems with the config from CreateSimulationConfig. More... | |
| static SimulationConfig | CreateSimulationConfig () |
| Creates a simulation config with default settings, see SimulationConfig.InitMissingDefaults. More... | |
Public Attributes | |
| IReadOnlyList< EventBase > | Events => _events |
| The events raised during the last Step, or during the system initialization if no step has been executed yet. The event objects are pooled and only valid until the next Step. More... | |
Properties | |
| Frame | Frame [get] |
| The emulated verified frame. More... | |
Creates and steps a single verified Frame without a QuantumGame or a DeterministicSession, running only the systems passed in Args.Systems. Meant for tests, benchmarks and tools.
Uses the same system initialization and scheduling code as QuantumGame, but does not cover what the session does: prediction and rollbacks, input prediction, delta compressed input, checksums, snapshots, event confirmation and the RuntimePlayer serialization.
Exceptions thrown by the simulation code (systems, signals, tasks) are not caught, unlike in a session that logs them. They are thrown from the constructor (system initialization) or Step after all systems of the stage ran, see ExceptionUtils.ThrowIfAny: a single exception as is, several as an AggregateException. The frame should not be stepped anymore afterwards.
|
inline |
Creates the frame context and the frame and initializes the systems.
| args | Creation arguments. |
|
inline |
Creates an asset, invokes the optional action and adds the asset to the resource manager. If the action does not set a valid guid, the next free one starting at DefaultAssetGuids.Max is assigned.
The systems have already been initialized, assets they need in SystemBase.OnInit have to be passed in Args.Assets. Must not be called while the emulator is stepping.
| T | : | AssetObject |
|
inlinestatic |
Creates a simulation config with default settings, see SimulationConfig.InitMissingDefaults.
|
inlinestatic |
Creates an emulator without a map that runs systems with the config from CreateSimulationConfig.
| systems | The root systems in schedule order. |
|
inlinestatic |
Creates an emulator with map that runs systems with the config from CreateSimulationConfig.
| map | The map, see Args.Map. |
| systems | The root systems in schedule order, including the physics systems if needed. |
|
inline |
Sets the input of a player. The input is kept for all following steps until it is set again.
| player | Player |
| input | Input |
|
inline |
Adds a command of a player to the next step. The emulator takes the ownership of the command.
| player | Player |
| command | Command |
|
inline |
Marks the player as present (connected) and sets its runtime player data during the next step, which raises ISignalOnPlayerAdded. The actor id of the player is its index + 1.
| player | Player |
| data | Runtime player data |
|
inline |
Marks the player as not present (disconnected) and raises ISignalOnPlayerRemoved during the next step. Like in a session, the runtime player data is kept. Cancels an AddPlayer that was not stepped yet.
| player | Player |
|
inline |
Emulates ticks ticks.
| ticks | Number of ticks to emulate. |
|
inline |
Frees the frame, disposes the frame context and unloads the assets of the emulator's resource manager.
| IReadOnlyList<EventBase> Quantum.Testing.FrameEmulator.Events => _events |
|
get |
The emulated verified frame.