Skip to content

Add Steam networking capabilities (Round 2) #34

@Domarius

Description

@Domarius

Is your feature request related to a problem? Please describe (REQUIRED):
This is a new round of mappings required to continue multilayer development to utilise Steam's lobby and matchmaking features.

Describe the solution you'd like (REQUIRED):
There is a list of functions that need mapping, below.

Describe alternatives you've considered (REQUIRED):
We are implementing functionality that is not yet implemented from the Steam extension for Defold. I'm testing out the functionality as its implemented while the Defold team provides the mappngs.

Additional context (OPTIONAL):
Discussion is here: https://forum.defold.com/t/steam-multiplayer-api/80588/9

Ok now that I'm attempting to actually do it, looks like there are more functions and events that need mapping that I didn't realise when just reading the documentation. The next immediate issue I ran into is missing a mapping for "CreateLobby".

I "cheated" and use ChatGPT to assess the situation and make a complete list, but it's been extremely correct on this topic so far and this will likely save us many incremental back and forths as I try a bit, run into a roadblock, etc. etc.


Here is a comprehensive, focused list of Steamworks API functions and callbacks that should be mapped in Defold's Steam extension (extension-steam) in order to fully support Steam lobbies and friend joining via lobbies.

Each entry includes the original Steamworks symbol and a suggested Lua binding name consistent with the existing Defold Steam API.


🧱 Core API Functions to Bind

🟩 Lobby Management

Steamworks C++ Function Suggested Lua Binding Description
ISteamMatchmaking::CreateLobby(...) steam.matchmaking_create_lobby(lobby_type, max_players) Creates a lobby
ISteamMatchmaking::JoinLobby(CSteamID) steam.matchmaking_join_lobby(lobby_id) Joins an existing lobby
ISteamMatchmaking::LeaveLobby(CSteamID) steam.matchmaking_leave_lobby(lobby_id) Leaves the specified lobby

🟦 Lobby Data Management

Steamworks Function Suggested Lua Binding Description
ISteamMatchmaking::SetLobbyData(...) steam.matchmaking_set_lobby_data(lobby_id, key, value) Sets key-value data for the lobby
ISteamMatchmaking::GetLobbyData(...) steam.matchmaking_get_lobby_data(lobby_id, key) Retrieves a specific key from the lobby
ISteamMatchmaking::GetLobbyDataCount(...) steam.matchmaking_get_lobby_data_count(lobby_id) (Optional) Gets the number of keys
ISteamMatchmaking::GetLobbyDataByIndex(...) steam.matchmaking_get_lobby_data_by_index(lobby_id, index) (Optional) Enumerates keys

🟨 Lobby Member Information

Steamworks Function Suggested Lua Binding Description
ISteamMatchmaking::GetNumLobbyMembers(CSteamID) steam.matchmaking_get_num_lobby_members(lobby_id) Returns member count
ISteamMatchmaking::GetLobbyMemberByIndex(CSteamID, i) steam.matchmaking_get_lobby_member_by_index(lobby_id, index) Gets the SteamID of a member

🔄 Lobby Messaging (Optional but Valuable)

Steamworks Function Suggested Lua Binding Description
ISteamMatchmaking::SendLobbyChatMsg(...) steam.matchmaking_send_lobby_chat_msg(lobby_id, message) Sends a chat message to all lobby members
ISteamMatchmaking::GetLobbyChatEntry(...) steam.matchmaking_get_lobby_chat_entry(...) Retrieves received messages

🔔 Required Callbacks to Map

These allow the Lua code to react to the result of lobby operations.

Callback Struct Event Constant Description
LobbyCreated_t steam.CALLBACK_LOBBY_CREATED Fired after CreateLobby() call completes
LobbyEnter_t steam.CALLBACK_LOBBY_ENTERED Fired when local user successfully joins a lobby
GameLobbyJoinRequested_t steam.CALLBACK_GAME_LOBBY_JOIN_REQUESTED Fired when a user clicks “Join Game” via Steam friends
LobbyChatUpdate_t steam.CALLBACK_LOBBY_CHAT_UPDATE Fired when a player joins, leaves, or is kicked
LobbyChatMsg_t steam.CALLBACK_LOBBY_CHAT_MSG Fired when a lobby message is received (if chat is used)

📌 Optional but Useful Additions

These aren't strictly required, but they're common in games with lobby-based matchmaking:

Function Purpose
ISteamMatchmaking::RequestLobbyList() Enables you to query lobbies from other players
ISteamMatchmaking::AddRequestLobbyListStringFilter(...) Filters lobby results
ISteamMatchmaking::GetLobbyByIndex(...) Lets you enumerate found lobbies
ISteamMatchmaking::RequestLobbyData(CSteamID) Requests updated data for a lobby
ISteamMatchmaking::SetLobbyJoinable(CSteamID, bool) Makes lobby joinable or not (host-only)

Steam Documentation reference for matchmaking:
https://partner.steamgames.com/doc/api/ISteamMatchmaking


Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions