Client-side prediction for new objects?
Options
Crukiln
✭
in Photon Bolt
After going through the Advanced Bolt Tutorial, it's still not clear to me how I would go about implementing client-side prediction for new GameObjects eg. instantiating a (slow-moving) bullet. The example only seems to modify existing GameObjects (the PlayerMotor) or instantiate cosmetic effects.
My thought process:
- Instantiate a local bullet on the client, send the Command Input to the server
- Server will BoltNetwork.Instantiate a bullet (to maintain authority and also so that other clients can see it) and update the Command Results
Problem:
The original client now sees 2 bullets with the locally instantiated one being slightly further ahead (due to network delay).
Upon the client receiving the Command Results, I could "snap" the locally instantiated bullet to the networked bullet but that defeats the purpose of client-side prediction. Alternatively, maybe I could hide the networked bullet, but then I lose the ability to correct errors.
Is there something I'm misunderstanding? I imagine this is a common problem that's been solved by other people so I don't want to reinvent the wheel.
My thought process:
- Instantiate a local bullet on the client, send the Command Input to the server
- Server will BoltNetwork.Instantiate a bullet (to maintain authority and also so that other clients can see it) and update the Command Results
Problem:
The original client now sees 2 bullets with the locally instantiated one being slightly further ahead (due to network delay).
Upon the client receiving the Command Results, I could "snap" the locally instantiated bullet to the networked bullet but that defeats the purpose of client-side prediction. Alternatively, maybe I could hide the networked bullet, but then I lose the ability to correct errors.
Is there something I'm misunderstanding? I imagine this is a common problem that's been solved by other people so I don't want to reinvent the wheel.
0
Best Answer
-
Client side prediction exists so that player input can be immediately responded to locally, a projectile that does not react to input doesn't need this. There are many ways to sync projectiles, you can see a few examples here. https://trello.com/c/XZrcCWnV/54-projectile-networking-samples5
Answers
-
Client side prediction exists so that player input can be immediately responded to locally, a projectile that does not react to input doesn't need this. There are many ways to sync projectiles, you can see a few examples here. https://trello.com/c/XZrcCWnV/54-projectile-networking-samples5