I have read Gambetta, Gaffer, and Valve's writing on game networking and have implemented a basic platformer using FSMs to control character behavior. In offline mode, inputs/collisions are sent to the FSM, which correctly sets the animation according to the state. In online mode, the client receives only positional updates and the FSMs aren't used. I figure I can add the current state to the updates, but am unclear on how to interpolate between 2 different states and how to time my animations. For example, consider an authoritative server simulating at 60Hz and sending updates every 6 ticks (10Hz). Assume my jumping animation takes 6 frames @ 60Hz.
tick |input|State |y |offline anim frame| client anim frame
-------------------------------------------------------------------
0 (sync)| |idle |0 | idle | idle
1 |jump |jumping|1 | jump1 | ?
2 | |jumping|2 | jump2 | ?
3 | |jumping|3 | jump3 | ?
4 | |jumping|4 | jump4 | ?
5 | |jumping|5 | jump5 | ?
6 (sync)| |jumping|6 | jump6 | ?
When the client receives the update for server tick 6, its 2 most recent states are {t: 0, y: 0, state: idle} and {t: 6, y: 6, state: jumping}. The y position is easy to lerp, but how do I interpolate the state/animations? Do I instead need to send a list of state changes w/ timestamps on each updates? That sounds kind of heavy.
Alternatively, I could send inputs with timestamps directly to all clients and let the clients simulate on their own (instead of interpolation). This seems like it would be the most accurate, but I've never heard of anybody doing it that way before. Positional interpolation seems to common practice.