# Off-Cloud Anchor Sharing Framework for Multi-User and Multi-Platform Mixed Reality Applications
## 3 Design and Implementation of the System
### System Design  
To illustrate the complexity and inner workings of the developed solution, Figure 2 shows its classes. It is worth mentioning that some of such classes, names and internal behaviors are strictly tied to the practical use case utilized to exemplify the proposed framework, which is later detailed in Section 4. Therefore, although the naming of some classes is specific for the use case, its internal behavior can be adapted and extrapolated to other uses cases and scenarios.  
* OverCookedNetworkManager: When using Mirror, it is required to implement a NetworkManager. This is in charge of managing and delegating the methods and events that are triggered when a server is started, a client is connected, etc.
* Player: This class is responsible for handling everything related to the connection, interactions with the environment and movement of the players. It is also used to exchange information with the server through Mirror commands.
* ObjectRef: This class represents an element shared by the network to reference an object (in this case, an ingredient or dish). It stores a reference to the represented GameObject (Prefab).
* ARInteractionManager: This class captures and manages all the MRTK events that are triggered when an MR user makes hand gestures or interacts with elements of the virtual environment. Some examples of these interactions can be clicks, pressing buttons or using the cutting board, among others.
* Slot: It symbolizes the point at which users can drop objects (in this particular case, countertops). This class could also be extended to create special Slots such as the trash can or the counter where finished dishes are placed for delivery.
* WorldAnchorSharedManager: This class manages all aspects related to anchor sharing and synchronization. It offers methods that are used, for example, from the Player, allowing both local synchronization in each device and global synchronization between server and clients. It uses the \"ARAnchorManager\" system from the Unity XR ARFoundation library and also OpenXR \"XRAnchorStore\".
* NetworkTransmitter: This class is used when sending an anchor between devices, being an adaptation of the NetworkTransmitter provided by Unity in one of their example projects [37]. The file has been taken as a reference to adapt it to the needs of the system developed in this project. This class is employed when the size of the serialized anchor exceeds the transmission limit imposed by the Mirror networking library (298,449 ); the data must then be split into smaller segments. Mirror internally uses a KCP-based transport layer, where the default window size is 4096. bytes. However, the maximum payload size per packet is determined by Mirror and calculated to be 298,449. bytes. Thus, the anchor is divided into appropriately sized chunks to fit within this limit, ensuring reliable and ordered delivery across the network.
* NetworkDiscoveryUI: This class is responsible for the automatic connection of users to the network, thus facilitating the connection between devices and avoiding the need to enter the server IP manually. Its methods are executed when the application connection panel is used, that is, when a user opens the application for the first time and connects to the network as a host or client. This is where Mirror's \"NetworkDiscovery\" component is encapsulated and used transparently to the user and developer, regardless of the platform on which the application is running.  
The following subsections describe in more detail some of the technical aspects of the design and implementation details of the main functionalities of the proposed framework: automatic user connection, anchor synchronization and the IoT interaction modules.