I'm working on a real-time game based on a grid. Each player can move a single square at a time. A server tracks the game state and notifies clients of changes.
It's possible for two players to make a conflicting move, such as attempting to move to the same square. How can I fairly resolve such conflicts when they happen?
My current approach is First come, first served: When the server receives a move, it immediately updates the game state to reflect that. It then discards any conflicting moves it receives later.
The problem is that the moment a move was received does not necessarily line up with moment it was sent. Players on a faster network connection will always have an advantage.
How can I deal with this?