Improving comm via internet. How to test.
A 2D Real Time Strategy space combat game.
Status: Alpha
Brought to you by:
mrevenga
Playing via internet is very slow. Too slow for manual operation.
One second of game needs ~2 real world seconds.
How can you make some tests?
Well I did:
sed -i 's/TEST 0/TEST 1/' include/general.h
sed -i 's/DEBUG 0/DEBUG 1/' include/general.h
sed -i 's/COMMDEBUG 0/COMMDEBUG 1/' src/spacecomm.c
sed -i 's/int debugcomm1=0;/int debugcomm1=1;/' src/spacecomm.c
Then launched with
$ time bin/spacezero > game.log 2>&1
However the log is huge and doesn't seem very helpful.
If you know the game runtime maybe you can cound objects and make some statistics.
So I'll send both server log and client log.
Our ping is 50ms, very stable.
Anonymous
Server log. real 20m34.088s
Client log. real 19m18.204s
Thanks you very much for testing.
I didn't test it over internet. One reason it is slow is because it
use TCP protocol. But there are things can be tested.
Now the communication between client and server is every three time
steps. This means around seven times by second (probably is too
much). It can be changed with the value of the constant NETSTEP in
spacecomm.h. Higher values allows less traffic but both client and
server must interpolate the trayectories of the objects. There are
leaps when client and server syncronize. Its possible that values
higher than three works fine.
The constant TEST in general.h allows to see other players pressing F9
and F10 and print to screen the number of ships and objects in game,
and the objects send by second.
The constant DEBUG add some information to terminal (I dont remember
now exactly what) but when the program finish write some game
statistics like frames/s, number of key strokes, number of objects
sended, obj sended by second, ... COMMDEBUG, debugcomm1 are used for
debug only.
Now the traffic is around 4-5 KB/s in normal game and can reach 10-15
KB/s during an attack. A ping of 50 ms sounds very good. All the
communication code must be rewrited and to use another protocol. In
the meanwhile it's posible that higher values of NETSTEP work not so
bad. Make me know if you tested it.
For see the traffic there simple tools as xnetload
http://rsmith.home.xs4all.nl/software/#xnetload that can help.