RealityKit Collaborative Session using Multipeer Connectivity

Does anyone have a working example of a RealityKit Collaborative session? The documentation is very sparse and I'm getting an error:

[GCKSession] Not in connected state, so giving up for participant [68A67812] on channel [6].


It seems the devices are connecting but that as soon as RealityKit is trying to sync, I get the error.

Replies

I am also looking for any sample code on how to do make a multiuser session.

This sample was published very recently: https://developer.apple.com/documentation/arkit/creating_a_collaborative_session

Thank you @gchiste for posting this.


Does Apple also have sample code for a solution that uses RealityKit's synchronization? I ask because I am looking for a simpler solution without having to use ARSession delegate functions.

Hi Ellohay,


Actually in the sample code he shared, they are using realitykit. It should be fine. However, they are using in this sample code the two delegate methods they mentioned that it shouldnt be used if you use realitykit. So I am not sure if this is change of plans or we can just not use these delegate methods.


Please let me know if you find a better way for collaberative session. I am searching for this since last WWDC 😀 .


Thanks

Hello @asddddaa,


The sample code uses RealityKit to place AR content, but does not use RealityKit's networking solution. Using RealityKit's networking is probably much simpler and I agree that there should not be a need to use delegate functions.


I will surely post a sample here if I find one.


Thanks

As noted in the Readme of the sample, "Although this sample draws its graphics using RealityKit, it doesn’t use RealityKit’s mechanism for over-the-network entity synchronization. Instead, it uses RealityKit as a renderer only as necessary to demonstrate ARKit’s collaborative session."


In other words, this sample is a demonstration of ARKit's collaboration api's, so it does not use RealityKit's synchronization.

Hello @gchiste,


Would you be able to post sample code for a solution that uses RealityKit's synchronization?

Thank you for sharing the sample. I'll give it a try!


I tried getting RealityKit sync to work and had no success. I wasn't sure if it was a bug or if I was missing something. I'll continue debugging and report my findings!


Thanks again.

I've been working on a sample all week but haven't got it working yet. As soon as I have something, I'll post a link here.

Any updates? I'm also trying to create collaborative session, but it doesn't work. I assume the problem is that synchronization component of all entities is always nil. Even if you try to set it explicitly, it will still be nil.


dump(entity.synchronization) // nil
entity.synchronization = SynchronizationComponent()
dump(entity.synchronization) // nil

I just posted an article on exactly this with a library to take away the boilerplate code and a working example.


https://medium.com/@maxxfrazer/realitykit-synchronization-289ba9409a6e


And the library to do most of the work for you complete with an example project:


https://github.com/maxxfrazer/MultipeerHelper


Hopefully it helps you all!

I have created a project:


http://https://github.com/amaroo2006/CollabSession


I have tested this project, and it works. You can use the touch gestures to show updates in real time.


The package dependency for MultipeerHelper can be found at the bottom of this article

https://medium.com/@maxxfrazer/realitykit-synchronization-289ba9409a6e

Hello @maxxfrazer


The article you posted helped to make a collaborative session. I will definitely be reading your RealityKit articles.


Thank you,

Ellohay

I was wondering if you were able to use realitykit entities loaded via external entities shared across peers.

I get the following

"[Assets] Failed to load asset path 'singlefilearchive:" and I am using copy bundle resources in build phases already