PUN Classic (v1), PUN 2 and Bolt are in maintenance mode. PUN 2 will support Unity 2019 to 2022, but no new features will be added. Of course all your PUN & Bolt projects will continue to work and run with the known performance in the future.
For any upcoming or new projects: please switch to Photon 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".
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
}