How many peers can an ARKit Shared WorldMap support without there being latency or memory issues?

I came across this post. The op asked when sharing an ARKit WorldMap in a Multipeer session is there a limit. MCSession does have an 8 person limit:


Sessions currently support up to 8 peers, including the local peer


Eskimo suggested to the op to use "NSNetService" and its "includePeerToPeer" flag to go beyond that limit.


I want multiple users to share their experience with other users and I decided to usee Bonjour for discovery because there isn't a peer limit. There is no host or guest, discovery is automatic (no user interaction). Once one user who is nearby with the app open it will automatically send their world map to anyone else who is nearby with the app open. The other person's worldmap will also get sent to that first user in return. If there are 50 users nearby all 50 of them will have a copy of each other's worldmap. Think of it like a bunch of users all sharing worldmapos with each other.


My app is not a multiplayer game or anything with "action". It's more like each user has a Pokemon character and once their worldmap is shared every user in that vicinity will all see each other's Pokemon character. This isn't a host/guest type setup, it;s 100% peer to peer. Every user auto connects to every other user. Once the connection is made it sends the user's worldmap (if no connection create a connection and send worldmap)


When Eskimo posted the anwer he didn't specify if there would be any issues with sharing a worldmap beyond 8 people. I have 4 questions:


1. In the worldmap docs it says Use the networking technology of your choice to send the resulting data to another device. The MultipeerConnectivity are example projects and it doesn't say anything about not using Bonjour or limiting the amount of users. In the application I described above (no action) should there be a limit to the number of users who can automatically share worldmaps and if so what should that limit be?


2. When sharing a worldmap are only the anchors shared (each Pokemon node and its worldPosition) or is the entire scene shared? For eg there are 50 users in a mall food court and one user puts their Pokemon node on a table will each of get a copy of the entire food court area or just the anchor that the Pokemon node is anchored to (and the Pokemon also)?


3. How much does data does each worldmap take up and what determines the size of the data? For eg if I'm in my kitchen that's one thing but if I'm at the beach that's another. Once I share my worldmap would that be considered the size of a small compressed photo or large uncompressed video. The problem with not knowing this is in my app if each worldmap is 1 gigabyte and 20 users all have each other's worldmaps then they would all have 20 gigabytes of worldmaps on their app.


4. Is there any specific reason MCSession and ARKit only supports 8 peers in a shared experience? I know it's built on top of Bonjour but Bonjour has no limit so there has to be some reason MCSession does.


Thanks,

Lance

Accepted Reply

You’ve asked three specific questions. The first one I can tackle here. The last two are are about ARKit than they are about networking. I don’t know anything about ARKit, alas, so I’m going to recommend you post those questions over in Graphics and Games > ARKit.

1. In the worldmap docs it says Use the networking technology of your choice to send the resulting data to another device. The MultipeerConnectivity are example projects and it doesn't say anything about not using Bonjour or limiting the amount of users.

The docs make it pretty clear that how you move the data across the network is up to you. MultipeerConnectivity is a fine choice for this sort of thing, and that’s why the sample code uses that. However, there’s no requirement to use that, and it would make sense to use something else if you’re hitting one of its limitations.

In the application I described above (no action) should there be a limit to the number of users who can automatically share worldmaps and if so what should that limit be?

I think you need to do some testing here. From a networking perspective, there are a lot of factors in play:

  • MultipeerConnectivity has a documented fixed limit on the number of peers per session (

    kMCSessionMaximumNumberOfPeers
    , currently 8). Trying to extend that by mucking around with multiple sessions is not a great plan. If you need to go beyond that that limit, you should switch to Bonjour + TCP.

    Bonjour + TCP has no fixed limit, but there are still practical limits. There are determined by a number of factors, which I’ll get into below.

  • I want to stress that using Bonjour + UDP is possible but it’s probably not a great idea. Specifically, using UDP multicasts are definitely a bad idea. Wi-Fi transmits multicasts very slowly — to improve the chances of the stations receiving the multicast — and that wastes bandwidth.

  • As to how many stations you can support, there’s a number of factors that apply, including:

    • The size of the data you need to transfer?

    • How often you need to transfer it?

    • The local Wi-Fi environment?

    While I’m not an ARKit expert, I suspect that you can come up with reasonable constraints on the first two factors. The last factor, the local Wi-Fi environment, is a real challenge. This can vary wildly from location to location and, even within a single location, from time to time. Hence my overall recommendation: To get a handle on this, you have to do some real world testing.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

You’ve asked three specific questions. The first one I can tackle here. The last two are are about ARKit than they are about networking. I don’t know anything about ARKit, alas, so I’m going to recommend you post those questions over in Graphics and Games > ARKit.

1. In the worldmap docs it says Use the networking technology of your choice to send the resulting data to another device. The MultipeerConnectivity are example projects and it doesn't say anything about not using Bonjour or limiting the amount of users.

The docs make it pretty clear that how you move the data across the network is up to you. MultipeerConnectivity is a fine choice for this sort of thing, and that’s why the sample code uses that. However, there’s no requirement to use that, and it would make sense to use something else if you’re hitting one of its limitations.

In the application I described above (no action) should there be a limit to the number of users who can automatically share worldmaps and if so what should that limit be?

I think you need to do some testing here. From a networking perspective, there are a lot of factors in play:

  • MultipeerConnectivity has a documented fixed limit on the number of peers per session (

    kMCSessionMaximumNumberOfPeers
    , currently 8). Trying to extend that by mucking around with multiple sessions is not a great plan. If you need to go beyond that that limit, you should switch to Bonjour + TCP.

    Bonjour + TCP has no fixed limit, but there are still practical limits. There are determined by a number of factors, which I’ll get into below.

  • I want to stress that using Bonjour + UDP is possible but it’s probably not a great idea. Specifically, using UDP multicasts are definitely a bad idea. Wi-Fi transmits multicasts very slowly — to improve the chances of the stations receiving the multicast — and that wastes bandwidth.

  • As to how many stations you can support, there’s a number of factors that apply, including:

    • The size of the data you need to transfer?

    • How often you need to transfer it?

    • The local Wi-Fi environment?

    While I’m not an ARKit expert, I suspect that you can come up with reasonable constraints on the first two factors. The last factor, the local Wi-Fi environment, is a real challenge. This can vary wildly from location to location and, even within a single location, from time to time. Hence my overall recommendation: To get a handle on this, you have to do some real world testing.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Eskimo,


Thanks for the reply.


I don't think I need to use Bonjour + UDP because I don't think video is getting shared although I could be wrong. I didn't see anything in the docs about the Multiuser AR Experience framework nor the Collabrative session framework sharing videos. I think the 8 peer limit is for people who want to create action oriented games like SwiftShot so that there won't be any latency issues. They can get up and going fast almost like UIImagePicker vs AVFoundation. Again I could be worng.


I posted the other questions in the gaming section. Once I find out exactly what is being shared (the object, node, and anchor or the entire scene with all 3) and I get an idea of the data size I'll max the number of users based on that. I can't test as of yet because I still haven't figured out how to connect the users and share data once Bonjour discovers them. I posted a question about it.


As far as the local Wi-Fi environment I would think that wether I use Bonjour + TCP or Multiuser AR Experience or the Collabrative frameworks the conditions would be based on outside factors more so then either framework itself. Either way you are 100% correct I need to do user testing.


On a side note the downside of testing with ARKit is you need actual physical devices and for what I'm doing lots of them 😟.


Appreciate the help, thank you!

Lance