Original Post
Those of you following my amazing adventures in writing a small space shooter game may notice this is probably my third or fourth question on the subject. This stuff is hard. Happily, though, I've actually got client prediction more or less working now. Major thanks to hplus and the gaffer tutorial on networked physics. I've got some more questions, though. So, let's say the client's time to the server is about 15 states' worth, so at time t, the client is rendering time t+15. The user presses the shoot button, and the client sends a message to the server that the client has fired. Now, my question is, if the lag drops suddenly, and the server gets the message at time t+5 instead of near to t+15, should the server hold off on recognizing that input for another 10 states or so? I could fix it by having the server buffer incoming inputs until the right time, but it adds quite a bit of complexity to the server, and a client who presses the fire key in 95% of cases would want the bullet to go a little earlier anyway. Second question, rotations. If there are two clients, A and B, and A begins to rotate, after a trip to the server and a trip to B, B will see A begin to rotate. Because of the prediction and the smoothing, A will get a short initial burst of turn speed, which is fine, but when A stops turning, B won't know about it for a while, so A will appear to keep turning until it suddenly reverses its turn a little bit. This can be really annoying because every single turn another ship does will always have that little hook of reverse-turn at the end. I considered not predicting the direction a ship is facing, adding a bit of roughness to the turns but not ever overguessing, but the direction a ship is facing affects its position if it's accelerating, which could introduce prediction errors. My question is whether there is another, better solution to this, and if not, which is better, an annoying small correction at the end of every turn (which is larger and larger with more lag), not predicting rotations entirely, or some middle ground?