So I am going to make a Live Action Networked Game (or at least a template for one) and would like some guidelines for how to implement it in theory.
Here's what I've gotten from the things I've read so far -
You have a server with an authoritative game state from some time in the past Si. At set intervals, for any period of time in which it has inputs from all of its clients, it will simulate the game state to a new authoritative state at time Sf, and then send this to all of its clients.
The clients will then revert their game states to Sf, discard all cached inputs before Sf, and then use the remaining ones to interpolate the game state up to time N, the actual current game time. To simulate the other client players, they will simply guess based on the last input given to them.
Whenever the clients update, they will continue to cache inputs for that period of time, and also send their inputs to the server.
So does that sound about right? Is there anything I can do to improve how a client guesses what the other clients are doing? Or just improve it in general?
Additionally, I am not sure whether or not I should use UDP or TCP. I know UDP is generally faster. However the server always needs to guarantee that it receives every client input, so I do not think UDP all by itself is reliable enough. Would it be worth it to implement some sort of reliability layer on top of UDP, or to just use TCP instead? And if so, what would be the best way to go about this? Is there a good library for Java that handles this kind of thing already?
Thanks in advance.