packet size limit for iPhone games?
Asked Answered
I

2

6

i am creating a multi player iPhone game using the multi player tutorial as the skeleton in the following link http://www.raywenderlich.com/3276/how-to-make-a-simple-multiplayer-game-with-game-center-tutorial-part-12.

With the architecture i am using (GameCentre peer to peer)one of the devices plays the role of the server. I have a question, just what is the limitation of the packet size? On average i need to send out 890 bytes per go...

Incontinent answered 3/5, 2012 at 23:12 Comment(4)
You can send pretty big packets, but you should then be concerned about speed. A big packet will take longer to send, when fast communication is important in a game. Generally, if you're packets are getting too big in a game, you can probably break it up into smaller packets, each with their own essential piece of data.Menis
hi thanks for responding, so by definition of a large packet is a packet of 1k considered fairly large?Incontinent
1k bytes? So like 1 kB? If you're sending 30 packets/second, then that's ~240 kb both ways in terms of connection speed, so it really depends on the target audience. It'll vary a lot whether over local, WAN, 3G, etc. To me though, that is fairly large. That's the equivalent of about 250 float values, or over 100 XY positions, every frame. Make sure everything you are sending is essential. If you have calculations or some kind of logic thing being sent, try standardizing its behavior and send a single byte flag saying "this happened" and perform any calculations client-side.Menis
well i have cut it down so that packets are only sent when touchEnd is called, but i see your point, it is best if i try sending as little as possible - thanks dude!Incontinent
H
1

Generally you should not rely on the network packet size. The packets can get fragmented (via TCP/IP and get re-assembled by the stack) or data get packetized based on MTU of the sending/receiving parameters.

Hillel answered 3/5, 2012 at 23:44 Comment(2)
thanks for the response, my concern is there a size threshold that if exceeded data will not be received at the other end?Incontinent
Not really. Your data will be packetized by the network stack and reconstructed on the other side. You don't have to do anything. The only limitation is a bandwidth, since mobile phones can be in a place with bad reception. Just make sure you handle errors properly.Hillel
I
1

Per the Game Kit Programming Guide:

  • Limit the size of unreliable messages to 1000 bytes or smaller in size.
  • Limit the size of reliable messages to 87 kilobytes or smaller in size.
Imp answered 7/5, 2012 at 22:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.