So, my mod had a problem where in multiplayer the missile's body would start lagging for clients as the server load increased, even though everything worked perfectly for the host.
Over the past two weeks I changed the architecture, split the missile into ClientMissile, ServerMissile, and MissileModel, moved all visual effects to the client, and added client-side prediction, interpolation, and smooth error decay (since the server's packets lag behind the predictions).
Only to find out that none of that changed the shit. In multiplayer. And the problem is that in F11 mode the changes actually improved the situation, and I can't reproduce the problem AT ALL. I tried adding lag, packet drops, bandwidth limits, capping TPS and the replication rate to 5 per second, and destroying a ton of objects, but in that configuration, the interpolation works perfectly.
Another weird thing is that even in multiplayer the smoke appears exactly on the predicted position, meaning that the system is working well and it's specifically the body that's lagging behind.
The object handle is negative (client-side), but there's another oddity - the server's raycast sees objects spawned by the client. I noticed this when I rewrote the architecture and the missile started detonating instantly (because the server no longer spawns the body, and I cannot reject it by handle). I would have thought this was a problem with the host's mixed environment, but the situation was repeated on the client in F11 mode). Does this mean that even client bodies pass through the server? Although that still doesn't explain why I can't reproduce the problem locally.
If anyone has experience resolving situations like this, knows something about it, or has given up on solving a similar problem - I'd love to hear your thoughts. But I hope that I'm just being stupid and missing something.
Git: https://github.com/yaetoti/TeardownMissileDev/tree/dev-v1.2
Workshop (old version, since the new one is still in development): https://steamcommunity.com/sharedfiles/filedetails/?id=3820804315
Edit: added link to the workshop page