Predicting network load

Started by
2 comments, last by hplus0603 16 years, 10 months ago
Hi everyone I'm beginning work on my first attempt at a network multiplayer game, and before I actually started into anything serious I wanted to crunch some numbers and see how the network should behave. Here are some rough figures I came up with:
Input Update:       1  byte   every 10 ms
Correction Update:  20 bytes  every 50 ms

number of players:  32
Where Input Update is just info the client sends to the server about what keys they're pressing (and that the server forwards to the rest of the clients for local simulations), and the Correction Update is the server's version of every player's position, orientation, speed, etc. Now I've done some calculations, but I'd like to see if I'm going about the server part right. The server receives Input Updates from every user every 10ms, so most of the time the server will be downloading at (1 * (1000 / 10) * 32) = 3200 bytes per second. But for sending (let's just look at the Input Update for example), for each player it needs to send the input data for every other player, right? So that would be (1 * (1000 / 10) * 32 * 31) = 99200 bytes per second. Is my logic here correct? If so, it seems like it might sadly be a bit too much to host on my home connection (assuming the server is full, and including the Correction Updates and things like messages to add/remove projectiles). I'm hoping things like quadtrees will help cut down on the number of Correction Updates the server would need to send out. Anything else I can take into consideration?
Ok.
Advertisement
Sending incremental updates 100 times per second is ridiculous overkill, especially given that for every byte of input you've got about 40 bytes of packet overhead. Try 5 updates per second. For the correction update, try 10 times per second.
Thanks for the advice, I'll go with that. My numbers did seem a bit much but I wasn't sure (having little/no experience here).
Ok.
High-action games seldom send updates more than 30 times a second.
RPG type games can get away with 3 times a second.
For each packet you send, there is 20 bytes if IP header, and 8 bytes of UDP header (assuming UDP), unless you're on a modem where van Jacobsen compression applies, and you get 5 byte headers.
Yes, the N-squared kills you when hosting large games. That's why most games won't work well when you host more than 8 players, unless you're running on a dedicated host in a well-connected data center.
While you can improve the average case by doing interest management, consider how often the worst case will happen, and what your game will do to manage that. "Failure" is not a good mangement strategy :-)
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement