I’m currently developing a racing game, and something I have noticed is that there is a bit of discrepancy in the positions of characters on the server and on the client (i.e. a bit of lag between the two). Usually this is fine, but when two players are side by side (ish), the player will appear to be slightly ahead on the client but be slightly behind on the server.
Currently, player positions (1st, 2nd, 3rd etc.) are handled on the server (which seems intuitive) and sent to the client to display in UI (so you know your own position at all times). This leads to cases where you appear to be 1st on screen but the UI shows 2nd (and indeed your are 2nd from the server’s perspective).
How should I go about addressing this? Is there away to reduce this discrepancy? Should I trust the client more with positions? What would you recommend?