Today I did three major things:
- Handling disconnection
Now when a client goes away, his id goes back to a pool of disconnected ids. If a new client comes in, he's gonna take his place, thus avoiding leaking players behind
-Testing
I used Clumsy, a program to disturb network packets in many ways, and I tested many aspects of the game. The game reacts very well to packet loss. Then, noticing that it didn't react nicely with packets out of order and duplication, I add a check that removes packets with a time which is smaller than a time already received, and that solved both problems. Finally the game behaves not so well with lag, with a very intense...well..."laggy" effect.I'm not sure if this is entirely my fault or if this is what I should expect from the simple interpolation method I'm using.
- Network time interpolation
Testing allowed me to notice that with high lag the client ships were just following behind, which meant that I was not using the network shared time for interpolation, but just the normal local time. So I added a timestamp to packets, and the value is used for prediction. This solved the lag problems (meaning that now it syncs the players correctly, but the movement is still badly jittery)
Nessun commento:
Posta un commento