XNA Creators Club Online
Page 1 of 1 (6 items)
Sort Posts: Previous Next

I need advice on packet size - Thanks in advance!

Last post 09-02-2008 7:03 PM by Sparkworker. 5 replies.
  • 08-29-2008 5:33 PM

    I need advice on packet size - Thanks in advance!

    Hi again!

    After much sweat (I worked at McDonalds this morning) I have finally got a nice little system for my game. The game can now run five ships at a time (far cry from 50, I know) but it now allows you to swap the fleets you have out there - the "Sky beam" picks up and replaces fleets with another fleet that is waiting "in orbit".

     

    Anyway. The packets I send now contain pretty much the entire gamestate - or at least half of it. All the ships on the one side are sent over, each one requires 15 bytes. As well, the health of the ships on the other side are sent over - one byte each. Wether or not a win occured, types and lengths ect. are packed into one byte.

     

    After all this, the maximum size of one packet works out to be 86 bytes. Plus header = 137 bytes.

     

    Is this packet too big? I hope to be able to send it out at least ten times per second, optimally 20 or 30 times per second (as my prediction algorithms could use a little work....)

     

    Looking at the network prediction sample, the packets sent in it are 91 bytes in size, and it works perfectly well. Can someone help me out here? Think it'll be okay? Or do I need to do a cut down in size?

     

    Thanks in advance for the advice - btw, this is an old thread I've recycled, so the stuff following won't be continuous.

    Soli Deo Gloria   -   To God alone be the Glory
  • 08-29-2008 6:04 PM In reply to

    Re: Packet Max Size?

    For best results, you shouldn't send more than 8 kilobytes per second.

    Each packet you send has about 50 bytes of overhead (more, if voice is used). However, each packet may include multiple messages.


    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 08-29-2008 8:31 PM In reply to

    Re: Packet Max Size?

    Well aware of that, but thanks! I already compact multiple ships into one packet - hadn't considered packing other messages into one.... Good thinkin!

    I'm more wondering if there is a physical limit to how much gets sent in one Update. I'd rather send out more packets with less if they go faster than one large one with more. (I don't want XNA to break up my packets into chunks you see.... I realize routers do that, but I want it to get there asap.)

    Thanks anyway!


    Soli Deo Gloria   -   To God alone be the Glory
  • 09-02-2008 12:16 AM In reply to

    Packet updates! Please give advice!

    Hi again!

    After much sweat (I worked at McDonalds this morning) I have finally got a nice little system for my game. The game can now run five ships at a time (far cry from 50, I know) but it now allows you to swap the fleets you have out there - the "Sky beam" picks up and replaces fleets with another fleet that is waiting "in orbit".

     

    Anyway. The packets I send now contain pretty much the entire gamestate - or at least half of it. All the ships on the one side are sent over, each one requires 15 bytes. As well, the health of the ships on the other side are sent over - one byte each. Wether or not a win occured, types and lengths ect. are packed into one byte.

     

    After all this, the maximum size of one packet works out to be 86 bytes. Plus header = 137 bytes.

     

    Is this packet too big? I hope to be able to send it out at least ten times per second, optimally 20 or 30 times per second (as my prediction algorithms could use a little work....)

     

    Looking at the network prediction sample, the packets sent in it are 91 bytes in size, and it works perfectly well. Can someone help me out here? Think it'll be okay? Or do I need to do a cut down in size?

    Thanks in advance.

    Soli Deo Gloria   -   To God alone be the Glory
  • 09-02-2008 6:39 PM In reply to

    Re: Packet updates! Please give advice!

    You can work this out for yourself. Jon already gave you the info you need to do this:

    For best results, you shouldn't send more than 8 kilobytes per second. Each packet you send has about 50 bytes of overhead (more, if voice is used). However, each packet may include multiple messages.

    So, take the size of your packet. Add the size of the header overhead. Multiply by how many other machines you are sending this packet to. Multiply by how many times you are sending it each second. Is the result more or less than 8 kilobytes?

    XNA Framework Developer - blog - homepage
  • 09-02-2008 7:03 PM In reply to

    Re: Packet updates! Please give advice!

    Thanks again - I have already calculated that, it's under 8 kbps...

    I figured there was some physical limit for how much could be sent per frame (with speed issues, ect, packet maximum size, all that)... But I suppose that there isn't. Thanks!


    Soli Deo Gloria   -   To God alone be the Glory
Page 1 of 1 (6 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG