How to create a MultiplayerDelegate and use TabletopNetworkSession features?

When building a multiplayer Tabletop game, the documentation includes how to attach a custom TabletopNetworkSessionCoordinator, which could be used in addition to TabletopGame.MultiplayerDelegate. But so far, we have been unable to create these types of custom coordinators or have a delegate that works. Our current setup with our generic GroupActivity works by sending the session to TabletopGame's coordinateWithSession method (like in the current sample project), but we didn't find a way to access and control, for example, the arbiter, seats, player events, among other features mentioned on https://developer.apple.com/documentation/tabletopkit/tabletopnetworksession.

Is correct to expect having access to the participants, messenger, or journal without having to maintain a parallel coordinator?   possibly we are missing something here; any suggestions?

Hey @elkraneo ! Here is an example on how you can create a custom MultiplayerDelegate. You can create a class like this by providing a default implementation of the functions:

import TabletopKit
class CustomMultiplayerDelegate: TabletopGame.MultiplayerDelegate {
func playerJoined(_ playerID: PlayerIdentifier) {}
func didRejectPlayer(_ playerID: PlayerIdentifier, reason: any Error) {}
func joinAccepted() {}
func multiplayerSessionFailed(reason: any Error) {}
}

In order to use custom MultiplayerDelegate, you can do the following:

let tabletopGame = TabletopGame(tableSetup: setup.setup)
tabletopGame.multiplayerDelegate = CustomMultiplayerDelegate()

Thanks @matt_novoselov! We tried already, but it does not seem to be called, not in the simulator nor in real Shareplay sessions. Does it work in your case? What about TabletopNetworkSession? Have you managed to access it and any of its features? like
processincomingmessage(_:from:) for example ?

How to create a MultiplayerDelegate and use TabletopNetworkSession features?
 
 
Q