PUN Classic (v1.x) and Bolt are outdated and will not receive further updates. Of course, existing PUN Classic and Bolt projects will continue to run. New projects should use Fusion or Quantum.

Alternative SimulateController / ExecuteCommand

"Abuse" the executecommand in bolt

Usually you use ExecuteCommand() & SimulateController() to do the type of authoritative client-side predicted movement that say an FPS or TPS would but you can use it like that, basically ignoring the "resetState" and just have that as a target to "get to".

C#

public override void SimulateController() {
    IMyVehicleCommandInput input = MyVehicleCommand.Create();

    input.Throttle = ...
    input.Gear = ...
    input.Blah = ...;

    entity.QueueInput(input);
}
    
MyVehicleCommand serverResult;

public override void ExecuteCommand(Bolt.Command command, bool resetState) {
    MyVehicleCommand cmd = (MyVehicleCommand)command;

    // resetState means we got a state update from the server, this will only be true on the client
    if (resetState) {
        serverResult = cmd;
    }

    if (serverResult != null) {
        // if we have a server result, this is the last "verified" 
        // result from the server, the data will be available in 
        // cmd.Result and is specified by you on the Command asset.
        // this is your lerp target
    }

    // perform movement logic for player, this code execute on both client (controlling) and server
}
Back to top