this weekend I went back to an old multiplayer prototype I was working on. For now, I render the world state 100ms back in time, and interpolate the server states to compensate for lag and updating the server-controlled entities smoothly. When the client performs an action, I send the action to the server, roll back the server state to match more or less how the client saw it when performing the action, and execute it. Than I send the response back to the client.
Everything seems to work fine, but I have issue when simulating two players interacting with the same entity. Let's assume the entity is a monster, and both players will level up if they kill it.
Player A has a very slow connection, Player B a very fast one. A attacks, and a few milliseconds later B does the same. As long as B has a faster connection, B gets its event to the server earlier, get it processed, kills the monster, get the response and levels up.
While this is happending, the event from A arrives: the state goes back to when the moster was still alive, the monster gets killed again, and the response is sent back to A and B. A levels up (correctly because he killed the moster first), but than B is in this weird state where he leveled up, but the new server state says it never did and I need to somehow rollback.
How do you guys solve normally situation like this one? I could execute the events as they arrive to the server, without rolling back. But than nothing works decently 'cause my game is an action-packed game and I have to keep lag in consideration. Any suggestion?