@hplus0603 @kylotan My characters are fully predicted. Each local tick on the client, I simulate the player and send the inputs to the server. I perform full rollback before the simulation, when the necessary packets come in from the server.
I'm not sure what you mean by rendering the round-trip body. For the interpolation, I'm simply lerping using the last local simulation position, and the current local simulation position of the player. From there, I can get the lerp alpha from the fixed network clock: frameTimeAccumulator / simulationDeltaTime.
I got something good working last night. Like I said in my second post, I ditched the dual body approach. I now use a singular body for both simulation and interpolation. When it's time for the client to simulate, I
1.) disable “interpolation mode”,
2.) enable the character controller,
3.) snap the body position back to the “CurrentPosition” (read above), since the interpolator alpha doesn't actually get to ≥ 1 before the next simulation tick comes around, since my interpolations all happen after the simulation. Right before the simulation, “LastPosition” gets set. After the player moves, “CurrentPosition” gets set.
After the local simulation is done, the object goes back into interpolation mode, and uses LastPosition and CurrentPosition. Now that our clock has just processed a simulation tick, the local lerp alpha should be pretty close to 0, so the next render frame the client sees will be very close to “LastPosition”, if not directly on it. I then lerp normally until another simulation tick comes around. Repeat. It's a very seamless and smooth operation.
Anyways this seems to work pretty well from what I've tested so far. Haven't tested with rigidbodies yet but I don't think it's going to be an issue. I strayed away from the dual body approach for a few annoying reasons.
1.) When I was working with dual bodies, the projectile needed a spawn point (end of the gun barrel). This was really annoying when equipping guns on the client, as I found myself needing to replicate the gun on both bodies since the interpolated object with the camera ran the gun animations, and the simulated object needed a spawn point at the end of the barrel for the bullet. Super annoying to do. Now I can just spawn in one gun, have the same code for client/server, and everything works great ?
2.) Engines like unity don't like when there's more than 2 cameras, and more than 2 audio listeners in the scene. When I would spawn in the local character and duplicate/split it into the simulation/interpolation body, each would have a camera, audio listener, etc. This lead to a bunch of really clustererfucked spahgetti code where I wrote code to automatically try to remove all visual aspects from the simulation body (camera), and all simulation properties (character controller) from visual bodies.
I think I got sort of off topic from your replies, but there's hardly any information about this stuff online, so just wanted to share my findings so that other people don't waste time doing things wrong like I did ?