Why is reset state being called every first execution on the client
Options
eriken
✭
in Photon Bolt
Hi!
I've followed the tutorial for authoritative movement but replaced the motor with a simple transform.position modification. I might have misunderstood reset state but it seems to be true on each first execution on the client which I find very weird, I thought it was for doing correction? This happens even when standing still.
The code for executing the command looks like this:
I've followed the tutorial for authoritative movement but replaced the motor with a simple transform.position modification. I might have misunderstood reset state but it seems to be true on each first execution on the client which I find very weird, I thought it was for doing correction? This happens even when standing still.
The code for executing the command looks like this:
InputCommand cmd = (InputCommand)command; if(resetState) { transform.position = cmd.Result.Position; } else { if(cmd.Input.Forward) { transform.position += transform.forward * 5 * BoltNetwork.FrameDeltaTime; } } cmd.Result.Position = transform.position;
0
Best Answers
-
Hello @eriken ,
Please, take a look here: https://doc.photonengine.com/en-us/bolt/current/gameplay/commands
The reset will occur for every confirmed Command received by the Client from the Server, and this always happens at the beginning of the frame, for every frame.
--
Ramon Melo
Photon Bolt Team1 -
Hello @eriken ,The article you linked mentions that the replayed inputs can be at least 10+ commands, is there a way to see the exact number?
Yes, after a reset, all your local inputs are reapplied on top of the confirmed state. This number varies by the size of the internal input queue and depends on how many inputs you are added to the queue, the simulation rate, and other factors.Also, the documentation recommends resetting input only after queuing it but the advanced tutorial on authoritative movement does not do this and I think it could run in to the problem described in the "queuing input with commands" section, or am I mistaken?
This is really related to how you store your inputs. On the Advanced Tutorial, some inputs are checked right at the beginning of the SimulateController(), so they are all updated when the command is created.
--
Ramon Melo
Photon Bolt Team1 -
Hi,
That is just a way to do the input pooling.
We advise building an input system similar to the one described in the documentation.
If you found any issues with that approach, let us know, so we can fix them or give guidance.
--
Ramon Melo
Photon Bolt Team0
Answers
-
Hello @eriken ,
Please, take a look here: https://doc.photonengine.com/en-us/bolt/current/gameplay/commands
The reset will occur for every confirmed Command received by the Client from the Server, and this always happens at the beginning of the frame, for every frame.
--
Ramon Melo
Photon Bolt Team1 -
Hello @ramonmelo,
thanks for your quick response!
Okay, so, regardless of how the client predicted the action that the command is relevant to, the client resets and runs them again to catch up. The article you linked mentions that the replayed inputs can be at least 10+ commands, is there a way to see the exact number?
Also, the documentation recommends resetting input only after queuing it but the advanced tutorial on authoritative movement does not do this and I think it could run in to the problem described in the "queuing input with commands" section, or am I mistaken?0 -
Hello @eriken ,The article you linked mentions that the replayed inputs can be at least 10+ commands, is there a way to see the exact number?
Yes, after a reset, all your local inputs are reapplied on top of the confirmed state. This number varies by the size of the internal input queue and depends on how many inputs you are added to the queue, the simulation rate, and other factors.Also, the documentation recommends resetting input only after queuing it but the advanced tutorial on authoritative movement does not do this and I think it could run in to the problem described in the "queuing input with commands" section, or am I mistaken?
This is really related to how you store your inputs. On the Advanced Tutorial, some inputs are checked right at the beginning of the SimulateController(), so they are all updated when the command is created.
--
Ramon Melo
Photon Bolt Team1 -
This is really related to how you store your inputs. On the Advanced Tutorial, some inputs are checked right at the beginning of the SimulateController(), so they are all updated when the command is created.
Sure, it's updated, but as the article describes, what happens if the jump was pressed the frame before SimulateController runs PollKeys, thereby missing the player trying to jump?0 -
Hi,
That is just a way to do the input pooling.
We advise building an input system similar to the one described in the documentation.
If you found any issues with that approach, let us know, so we can fix them or give guidance.
--
Ramon Melo
Photon Bolt Team0