I'm trying to figure out the best way to handle latency compensation with locally instantiated projectiles through RPC's. It's all authoritative, currently, I'm teleporting it. Simplified, it's something like:
1)Shooting client instantiates rocket locally, sends RPC to server to do the "for real" rocket
2)Server instantiates the rocket, but with a start position of:
startPosition + direction*((Network.time-info.timeStamp)*velocity).
Then sends an RPC to other clients (besides the owner) to create a rocket, with an additional float parameter of the original shooting client's timestamp (origTimeStamp)
3)Remote clients instantiates the rocket, but with a start position of
startPosition + direction*((Network.time-(info.timeStamp+origTimeStamp))*velocity)
So I'm offsetting the starting position by a distance equal to the amount the rocket should have traveled in that amount of latency. Only the server's rocket can actually explode, and tell other clients where the explosion should be. This seems to be working pretty well, the only problem being, depending on latency, the shooting client might not be able to hit enemies at point blank, because the server's rocket is being created past it. I could fudge it with a raycast on the server, but I feel like that might lead to discrepancies with point-blank rockets.
My next thought was to fudge it so server and remote client rockets have an increased velocity until they "catch up" with the original shooter's timestamp, but I'm not sure how to calculate it both what it should be, and how long it needs to stay at that velocity.