Game causes lag on VoIP

Started by
3 comments, last by hplus0603 12 years, 1 month ago
Hi,

the thing is this:
The networking of my game works relatively good (using java and udp (DatagramSocket)), but I have an issue when testing it with my friends over Skype or Teamspeak and I don´t have an idea why that is so.
We are connected using hamachi (it simulates a LAN-connection) and there is no lagging at all in the game, but every time the client tries to send data to the server, skype skips a some millisecs, causing great lagging so I´m not able to understand what my friend is saying at all.

For me it looks like sending a package over udp takes relatively long and blocks skype from using the connection in this time.
If you need some code, calling the method looks like this:

data = new byte[....];
....
DatagramPacket sendPacket = new DatagramPacket(data,data.length,HOST_IP,SERVER_PORT);
socket.send(sendPacket);

The maximum size of an udp-package is 1024 in my application; is this to big?
Or is there another, better way of sending packets using udp?


Hope you have suggestions on this,
thx in advance
Advertisement
1024 bytes is too long if you're using a 56kbps modem. It's not a problem if you're using a megabit-upload cable modem, assuming you're only sending a few of those per second.
enum Bool { True, False, FileNotFound };
1024 bytes is too long[/quote]

Well, 1024 is the maximum, usually those packets are not so big (150 bytes or so).
But thx anyway, i will run tests as soon as possible and post the resuluts.
ok, I changed the maximum size to 310 and it indeed works, but still not as good as I wanted it to be.
Maybe i will consider splitting the packets to 2 or 3 more if they meet the new maximum size.
Still thx, I really thougt 1024 bytes would be little enough by far...
What is your upstream speed? How many of the packets do you send? To how many other players?
The problem might not be the size of each packet, but the total bandwidth used.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement