Timing#
The server runs once per frame, between the game’s vehicle solver steps. Calls read the state of the last step, and a change takes effect in the next one. This script sets the throttle, then waits for a stream of the thrust to change:
thrust = conn.add_stream(getattr, vehicle, "thrust")
vehicle.control.throttle = 1
vehicle.control.engine_on = True
print(f"Thrust straight after: {thrust()} N")
with thrust.condition:
thrust.wait()
print(f"Thrust a frame later: {thrust()} N")
vehicle.control.engine_on = False
Calls That Wait#
Some changes go through the game’s input events, which apply at the start of the next frame. The procedures that make them return once the change has applied, so the next call sees it:
The part module actions, such as
Engine.Active,Decoupler.DecoupleandParachute.Deploy.KSA.LaunchVehicle, which returns once the vehicle is on the launch site.Vehicle.AddBurn, which returns once the flight computer has timed the next burn.
KSA.WarpTo returns once the warp has finished. The flight computer executes a burn only at
normal speed, so warp to shortly before it.
Predictions#
The game predicts trajectories, impacts and the performance of a vehicle’s sequences on worker
threads. Burn.Orbit, Orbit.NextOrbit and Flight.TimeToImpact reflect a change to
the trajectory shortly after it. The service recomputes Sequence performance itself, at
most once per game time, as the game does so only while its windows are open.