Transfering Lots of data quickly in a net game

Blitz3D Forums/Blitz3D Programming/Transfering Lots of data quickly in a net game

asdfasdf(Posted 2006) [#1]
I have a game that calls for transfering of positions of people, tanks, aircraft, arrows, bullets, ship, etc over a networked game. How can I compress the data so it transfers quickly? Compression? or what? Thanks


Gabriel(Posted 2006) [#2]
Put all your update into a single packet so you can send it all in one go. ( This is probably obviously, but I do recall a certain MMORPG expert who was sending everything one byte at a time in his "optimized networking engine" so it's worth stating the obvious, just in case. )

Yes, you might find that once you've got your packet of data that compressing it, sending it and decompressing it again is faster. Or you might not. You'll have to experiment with that to see if and how much it helps. For BlitzMax this is easy, but I haven't done B3D in a long time. I'm sure somewhere around here there's a function or a library which can compress a bank, an array or a string or something in memory.

But don't rely on compression. Make sure you pack your data as well as you can even before compression, you may even find it means you don't need to use compression. Just think about each byte and whether it's being used to the fullest. Normally I wouldn't suggest optimizing things like booleans, but for networking, I just might consider packing eight booleans into a byte.


H&K(Posted 2006) [#3]
Never having had to do this myself, I can only support what Gab has said.

Make sure that the "Lots" of data is all real data that is needed. As has been said on these boards its quite tempting to let Bmax deal with (For example) bytes asthough there were ints. (That is one Byte by itself is as long as an Int you need 4 next to each other to be really bytes)

And although it seems obvious dont send any data that cannot possible have changed since last time you sent data. As a stupid example, a tileType might contain the name of the Tile, and internaly in your program you might be passing this round (cos its only a pointer), when it comes to the Net YOU KNOW, that the name has not changed, so dont sent it.


LAB[au](Posted 2006) [#4]
And remember there is a maximum size for packets in TCPIP UDP, I don't remember how much but while trying to send a 320x240 BW picture over network I touched the limit. I will add that compression is not any good for LAN (fast) networks, except if you are using techniques like described above. And packet loss happens, so it is good to send global state messages from time to time.


Baystep Productions(Posted 2006) [#5]
We need Wings to help us. The VOIDRPG seems to work well.