Client-side prediction for new objects?

Options
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.

Best Answer

Answers