pydatagram overhead

Hello everyone, I’ve been tinkering with Panda3d for a few months. I’m one of the dreamy eyed MMOG independants.

My question is how much data (in bits) overhead comes with a pydatagram? If I transmit a datagram of only a single boolean value is it equivalent to a transmission of a single bit? Or is there some other overhead I’m not aware of?

I ask because bandwidth is’spensive. To get the biggest bang for your buck out of an MMO (especially the types independants like to dream of) you need every bit of transmission, client and server side accounted for.

As a side note I’d like to point out that while it’s important to think about bandwidth, it’s less of a problem than you would think.

Dunno if a boolean value would be sent as a 0/1 or if it has an overhead though.

Thanks,

My primary issue right now is transmiting ‘items to be displayed’ for avatars. Each avatar consisting of a number of crafted objects (armor, shirt, boots…). It would be nice to allow for as many different items as possible. As each item is a combination of display relevent attributes or features, this can add up quick. Especially being limited to byte intergers.

I need to send data as binary, and then interpret on the client. If addBool just sticks a single bit into the datagram then it will suffice.

I am also looking at Bitstring on the possibility bitstrings can be transmitted through pydatagrams.

Its probably nit-picking but it would still be nice to know how much extra bits a datagram carries regardless of data added to it.

I would guess that since you must specify the data type when retrieving it on the other end using an iterator, that there is no extra data sent in regard to adding more data onto an existing datagram.
You can use an int as a bit field, for example an 8-bit int would give you the equivalent of 8 bools.

Most of the time you wont have to worry about it… A… making a mmo will take forever… B… you’ll need a server to even handel that sorta traffic… C… you also have to worry about for fast your data is going too (also know as ping).

Besides that… bandwidth is perty cheap actully…

as for clothing… send a few ints/chars… why? Because you can pull data from them. For example:

(0000|0000) that could inreturn pass on two items per int. So 0000 gives you about 16 combinations per int. Even could add another int to say if x gets a x2 for up to more=)

To answer your question precisely, a bool is packed (via dg.addBool()) as an 8-bit byte. When you transmit a datagram via TCP using the ConnectionWriter system, it automatically prepends a two-byte length (or possibly four-byte if you configure this). But the TCP overhead itself will dwarf all of this; it sends each socket write as one or more packets of about 1000 bytes.

Bandwidth is indeed important, particularly on messages that are sent frequently and to a wide area (like telemetry updates), but optimizing it is a complex subject.

David

Verrry interesting

It seems I’ve only hit the tip of the iceburg so far…

I’m a little confused, your saying TCP packet(s) is sent as roughly a kb. Does this mean data is buffered until enough is available to be sent. If I send a single 8bit integer TCP will send in a (mostly) null packet?

If you set the config variable “collect-tcp 1” then Panda will hold up TCP datagrams until enough are collected to send, or until 0.2 seconds elapses, whichever comes first. But by default, it doesn’t do this, and packets are send as soon as you call send(), regardless of how wasteful that is.

Still, everyone else’s advice is good here: you’ve got your work cut out for you already in plenty of other areas if you plan to make an MMO. Bandwidth utilization is such a tiny part of the problem you’ve got ahead of you; probably better to focus on making the thing work first, and worry about optimization later.

David

Great info, thanks.

I’m looking at software to monitor socket activity. I’ll experiment and calibrate for efficiency throughout developement.
Does anyone know of a particularly good program for this?

wireshark. Interesting that panda3d disable the nagle algo by default…

I guess drwr just wanted to point out that the windowsize is important for the trafficconsumption. This should sound fimiliar ff you are used to the OSI-layers.
But first focus on the MOG itself (please dont call every little game a MASSIVE-MOG) and takle the (wellknown) problems. Most games never reach the level there optimisation ist needed.

Something that might help you is to put in code to see how big your datagrams are that get sent out. Here’s code I put in:

    def ProcessServerMessage(self, netDatagram):
        myIterator = PyDatagramIterator(netDatagram)
        try:
            print "Datagram Received"
            print "Datagram Size: " + str(netDatagram.getLength()) + " bytes"

What that does is print out a simple message to the console every time your client receives a datagram from the server and then it will tell you how many bytes that datagram consumed.

That way you can monitor how big your datagrams get as you develop your code. I’ve currently got my server sending out a datagram every second to every client that connects, and it’s about 300 bytes/client. So when I have 3 clients connected I know that my server is going to consume about 900 bytes/second of bandwidth just to keep the 3 clients updated.

Well your method only show up the workload and not the real traffic which includes the headers+wasted bandwidth by the framesize+fragmentation+resending if lost (reliable protocols only)+ack signals.

I’m looking at pkstat right now and maybe something else for my windows machine. Seriously the only worry is cost for the server. Well, that and getting as many players on screen with as much variety of fashionables and accessories as possible.

At about 20 cents a month per gigabyte any amount of bandwidth that would challenge even a 56k would be cost prohibitive. So I the client can take care of itself.

Of course the marketing guy says I can charge by the Minute!! We could call it Drain-to-Play! :open_mouth: