Steam Multiplayer API

I split this off from my Multiplayer on Nintendo Switch thread because I want to start with Steam multiplayer and then add Switch multiplayer as a second step. It didn’t seem right to make Steam API wrapper requests in the Switch forum so I’ve started a new topic here.

Again, very grateful to be able to work with you guys to enhance Defold, my favourite game engine. When they are implemented, I will test these functions and let you know how they go.

For now I don’t want to browse lobbies etc. I just want people to be able to invite their friends and accept invites. I also want to implement this functionality in game - it seems that although it’s convenient to use the Steam overlay to invite and accept, it’s good practice to let the user do it through the game for a seamless experience (especially for gamepad games) and I’ll want this in my UI for the Switch anyway.

Looking at the Defold Steam API I don’t see the required functions so if someone could confirm this for me and let me know what to do next that would be much appreciated.

Referring to the Friends, invites, and lobbies example, it seems I need;

  • SetRichPresence - so other friends know you’re in a joinable game
  • GetFriendCount - to get a total amount of friends to iterate through
  • GetFriendByIndex - to iterate through the friends to build a list of friends to invite
  • InviteUserToGame - to send the invite to the friend
  • GameLobbyJoinRequested_t - so the receiving game instance can respond to the invite and prompt the user to accept the invite
  • JoinLobby - so the invited user can join after accepting the invite from within my game’s interface

FYI those functions are only available through the global accessor functions SteamFriends() and SteamMatchmaking() not sure what that means for your back end but just thought it was worth mentioning.

As for actually keeping the gameplay in sync with each other, according to the Steam Networking docs, looks like I need;

  • ISteamNetworkingMessages - seems it’s a high level interface to send data between the games, it might be easier if this works, but if I need to be more lower level for bandwidth, I’ll have to use ISteamNetworkingSockets
  • ISteamNetworkingUtils - it would be good to have this because I think it’s normal to show someone’s ping next to their username somewhere in the interface

I’ve literally never done this before and have no way to test it in Defold without access to the functions (or perhaps setting up my own C++ project to test out the Steam API I guess :laughing:) so it’s possible I’ve asked for too much or too little. But even just the friends & matchmaking stuff would be a good start. In fact if you want to do it piecemeal and let me know when each one is done, I don’t mind testing individual functions as you implement them.

3 Likes

Perfect, thanks for the request. I created a feature request in the extension repo:

2 Likes

Oh awesome - would you like me to always make these as feature requests, or start on the forum first?

If you are uncertain of a feature request or would like to discuss if it makes sense to create one then start on the forum, but if it is a straight forward request or has already been discussed then start on GitHub!

1 Like

Ok cool, I have a good idea of where to start then :+1: