game network speed

I am building a 2 player network game but when I test it over the internet there is a lot of lag. On a LAN there does not seem to be a big problem.

A problem could be that I want to send a lot of data (the positions of all the objects in 2 ragdolls). I calculate all the physics on the host so that there is no sync problem, and then send all the moving objects positions/orientation to the client (UDP protocol).

Does anyone have an idea how I could speed it up?
-One thing I was thinking about is that I don’t need that high precision, if I knew a method how to reduce this it might help…
-I already spread the data over 5 seperate socket connections, the lenght of each cPickled packet is around 2000, I think this helped a bit

Lag is the time between sending a message and arriving at the destination.

You could send a short message (1 byte) to your communication partner. The partner could send a response back. Measure the time between sending the message and receiving the response. That would be the lag within your connection to this particular partner.

It does not necessarily depend on the size of the message.

I hope it helps

I also get errors that the “send action of a non-blocking socket can not be completed immediatly”, I thought that maybe the package was to large to upload in time. Maybe lag is not the best description.

If I only send the input data of the client and do not send anything back than I get an immediate response, no delays (also ping in cmd prompt gave 1ms for internet and 0ms for LAN.) So maybe all the extra data is breaking down the connection. Pinging when the game is running gives values up to 38ms delay.

Bump… Anyone an idea? I suppose it is not the simplest of problems to solve :eek:

you are sending a lot of data, most games only send the other players location and orientation, and then a couple (usually less than 3) values to show what action frame the player is in, wheather they what they are shooting, and what weapon is selected.

everything else (like uh, say 'physicsof specific objects for example) is calculated on each persons machine, individually, using the other players data to explain how they are affecting the enviroment… that is why most p2p game networks don’t try to send extra objects, only the players, if they dont have to.

halo and COD, can send extra objects physics data along, because they have private (and fast) host servers…

so what you are doing will always be laggy across the internet, unless you get a private server…

sorry man, i’m sure what you are doing is cool (network ragdolls, how can that not be fun), but it just isn’t practical.

good luck
-theuncool1

Thanks for the comment, I will see if I can find another way.
Maybe I can combine local physics with object updates, else I am afraid to run into sinc problems (working on a melee fencing game :cool:), it will probably be more work though to combine it :(.

I could also try to further cut the data stream but that will have its limits (orientation matrices to quats etc), can I set the data precision somewhere? :eek:

And with reducing the number stream to bare essentials I could reduce the numbers I sent from 415 to 247 numbers, 30 times a second… Still a lot I suppose

This might help you:
http://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization