codecat / unet

Unified Lobby Networking library in C++, providing cross-play between Steam lobbies, Gog Galaxy lobbies, and Enet sockets.
MIT License
7 stars 1 forks source link

Rich invites #17

Open xMyran opened 4 years ago

xMyran commented 4 years ago

Unet should support rich invites for Steam/Galaxy/Discord, something like this might work:

Unet services subscribe to the appropriate events (for Steam, OnRichPresenceJoinRequested and OnGameLobbyJoinRequested, maybe more). Whenever such an event is triggered unet requests the lobby. When the lobby request gets back unet calls its own callback for OnRichJoinLobby(LobbyInfo).

For this to work unet also needs to implement a connect string, this would work something like this: Whenever a unet service joins or leaves a lobby some function like Unet::RefreshConnectionStrings would be called. RefreshConnectionStrings would work something like: First it builds a connection string with the current lobby lobbyinfo, basically append each entry point (steam would have "st99999999", galaxy would have "gx9999999", enet would be "ip255.255.255.255:6555"), so you get a string which holds everything. ("st99999999 gx9999999 ip255.255.255.255:6555") Send that string to each service, which for Steam and Galaxy just sets the "connect" string. This is the string we get from the platform callbacks (OnRichPresenceJoinRequested...) and we use to get the lobby.