Hi everyone,
Thanks to Riven I’ve been able to test an internet-server-hosted version of my network game (which I’m itching to show you), but there is a problem with latency/lag and I’d really like some advice.
I’m not asking how to deal with lag, just how to minimise it over a TCP internet connection. For example, I find that sending lots of small messages(<100 bytes) tends to jam up things and latency spikes. I send a message for each mouse-move and this creates lots of messages per second. The latency between the computer I’m testing on and the internet server is normally 175ms (Sydney, Australia to Amsterdam, The Netherlands) but it spikes up to 700ms easily by waving the mouse around, and eventually seconds if two instances of the game are joined and both wave their mouse around for a while. Waving the mouse around can cause > 40 mouse move events per second, each of which I send separately.
So here are my questions :P:
- Is sending lots of small messages a bad idea? Should I delay them a little and send bigger byte arrays less often?
- I also send big byte arrays up to 10kb over the tcp connection every 5 seconds from the server to the clients (10kb only occurs when there’s lots of activity, normally it’s only 3kb), could they be jamming things up?
- When a lot of stuff is being sent from computer A to computer B over a TCP internet connection, does this delay stuff being sent from computer B to computer A?
- Is there any way to tell when the TCP-connection is being stressed so I can lay off it and not send stuff for a while? It seems to get progressively more bogged down when more stuff is written to the stream when it’s already lagging.
- Got any other handy tips?! ;D
Thanks!
Keith