When a client first connects to the server a Diffie-Hellman key exchange occurs to securely get private encryption keys to encrypt all packets.
The problem comes in: what if someone sniffing packets resend a "move right" command? Since they are simply resending the packet the encryption is still correct, and since movement commands can come at anytime, multiple times, the server cant just ignore multiple of the same packets.
Q: How do i prevent a packet-sniffer from replaying a move-right player command.
Edit: would the answer be timestamps included in the encrypted message? and then maybe any movement commands that are older then 500ms are dropped?