Hi,
I'm programming a multiplayer VR racing game on mobile, and I have implemented a basic multiplayer server.
I've used a naiive implementation that I've previously written for a mobile strategy game.
Algorithmically everything works fine. However I am getting alot of traffic on the network because my racing game has much more frequent updates than a strategy game.
As I said, the implementation is naiive (a brute force attempt to add multiplayer in 24 hours). This means:
- I am using TCP_NODELAY instead of UDP (can I use UDP on mobile networks? I allways assumed it was blocked)
- I send all the other 10 players' positions to each player every 200ms. The racing is in "ghost mode". There is no interaction with the other players, you just see them on riding next to you. So 200ms update rate is not a game issue. But any slower, and the lag becomes really noticable.
- I am using a text based delivery method (easy to debug across a C# unity client and a Java server [my old Centos server cannot run Mono] ). I am assuming this is not too bad because tcp headers are 20 bytes each anyway, and I am transporting 4 strings: 3 floats: x,y,z, and a 64 bit uuid.
Using all of this, i get around 1MB of data use per minute. Since this should run over a mobile network, that's way too high. You should assume I know very little about real-time multiplayer, with that in mind: Are there any obvious tips I should be using to reduce my traffic drastically?
My current guess is to try and reduce the text encoded messages. By replacing the 3 floats with fixed point ints (percision is not important for a ghost), and reducing the uuid to cyclical int. (If I ever have over 4 billion players, I'll be extatic to fix this bug :-) )