mk_lobby_backend_kindfunction
mk_lobby_backend mk_lobby_backend_kind(void)Perform the lobby backend kind operation.
Returns The resulting value.
#include <modkit/lobby.h>34 functions · 10 structs · 5 enums · 18 typedefs · 9 macros
Optional lobbies, invites, and matchmaking.
Enabled with MODKIT_ENABLE_LOBBY, which implies MODKIT_ENABLE_SERVICES. Disabled builds keep the same API and answer MK_ERROR_UNSUPPORTED. A lobby here is a directory service, not a transport: it gives you a member list plus key/value metadata, and the host advertises a connect string the others hand to mk_host_connect_url(). Gameplay traffic stays on modkit/peer.h. That boundary is deliberate a relay transport is a separate project, not a lobby feature. Two backends are possible, and that is the whole set. Steam has a real lobby service; everything else goes through a room server you run, because Play Games retired real-time multiplayer and Game Center's GKMatch is a transport rather than a directory. Query mk_lobby_capabilities() rather than testing platform macros.
mk_lobby_backend_kindfunctionmk_lobby_backend mk_lobby_backend_kind(void)Perform the lobby backend kind operation.
Returns The resulting value.
mk_lobby_backend_namefunctionconst char * mk_lobby_backend_name(void)Perform the lobby backend name operation.
Returns A borrowed pointer, or NULL when unavailable.
mk_lobby_capabilitiesfunctionmk_lobby_capabilities_t mk_lobby_capabilities(void)Perform the lobby capabilities operation.
Returns The resulting handle or value.
mk_lobby_connect_info_getfunctionbool mk_lobby_connect_info_get(mk_lobby_t lobby, mk_lobby_connect_info *out_info)Get state from the lobby connect info.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
out_info | mk_lobby_connect_info * | Receives the info. |
Returns True when the operation succeeds.
mk_lobby_connect_info_initfunctionvoid mk_lobby_connect_info_init(mk_lobby_connect_info *info)Initialize the lobby connect info.
| Parameter | Type | Description |
|---|---|---|
info | mk_lobby_connect_info * | Value for info. |
mk_lobby_create_asyncfunctionmk_result mk_lobby_create_async(const mk_lobby_create_desc *desc, mk_lobby_result_fn callback, void *user_data, mk_async_request_t *out_request)Create async for the lobby.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_lobby_create_desc * | Configuration descriptor. |
callback | mk_lobby_result_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_lobby_create_desc_initfunctionvoid mk_lobby_create_desc_init(mk_lobby_create_desc *desc)Create desc init for the lobby.
| Parameter | Type | Description |
|---|---|---|
desc | mk_lobby_create_desc * | Configuration descriptor. |
mk_lobby_data_atfunctionbool mk_lobby_data_at(mk_lobby_t lobby, uint32_t index, mk_lobby_kv *out_kv)Perform the lobby data at operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
index | uint32_t | Zero-based index. |
out_kv | mk_lobby_kv * | Receives the kv. |
Returns True when the operation succeeds.
mk_lobby_data_countfunctionuint32_t mk_lobby_data_count(mk_lobby_t lobby)Perform the lobby data count operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
Returns The resulting value.
mk_lobby_desc_initfunctionvoid mk_lobby_desc_init(mk_lobby_desc *desc)Initialize the lobby desc.
| Parameter | Type | Description |
|---|---|---|
desc | mk_lobby_desc * | Configuration descriptor. |
mk_lobby_get_datafunctionconst char * mk_lobby_get_data(mk_lobby_t lobby, const char *key)Get data from the lobby.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
key | const char * | Value for key. |
Returns A borrowed pointer, or NULL when unavailable.
mk_lobby_get_member_datafunctionconst char * mk_lobby_get_member_data(mk_lobby_t lobby, const char *player_id, const char *key)Get member data from the lobby.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
player_id | const char * | Value for player ID. |
key | const char * | Value for key. |
Returns A borrowed pointer, or NULL when unavailable.
mk_lobby_hostfunctionbool mk_lobby_host(mk_lobby_t lobby, mk_lobby_member *out_member)Perform the lobby host operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
out_member | mk_lobby_member * | Receives the member. |
Returns True when the operation succeeds.
mk_lobby_idfunctionbool mk_lobby_id(mk_lobby_t lobby, char *out_id, size_t capacity)Perform the lobby ID operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
out_id | char * | Receives the ID. |
capacity | size_t | Value for capacity. |
Returns True when the operation succeeds.
mk_lobby_initfunctionmk_result mk_lobby_init(const mk_lobby_desc *desc)Initialize the lobby.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_lobby_desc * | Configuration descriptor. |
Returns MK_SUCCESS or an error result.
mk_lobby_invitefunctionmk_result mk_lobby_invite(mk_lobby_t lobby, const char *player_id)Perform the lobby invite operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
player_id | const char * | Value for player ID. |
Returns MK_SUCCESS or an error result.
mk_lobby_invite_stringfunctionbool mk_lobby_invite_string(mk_lobby_t lobby, char *out_text, size_t capacity)A shareable join token for backends with no platform invite UI.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
out_text | char * | Receives the text. |
capacity | size_t | Value for capacity. |
Returns True when the operation succeeds.
mk_lobby_is_hostfunctionbool mk_lobby_is_host(mk_lobby_t lobby)Test whether the lobby is host.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
Returns True when the condition holds.
mk_lobby_is_initializedfunctionbool mk_lobby_is_initialized(void)Test whether the lobby is initialized.
Returns True when the condition holds.
mk_lobby_join_asyncfunctionmk_result mk_lobby_join_async(const char *lobby_id, mk_lobby_result_fn callback, void *user_data, mk_async_request_t *out_request)Perform the lobby join async operation.
| Parameter | Type | Description |
|---|---|---|
lobby_id | const char * | Value for lobby ID. |
callback | mk_lobby_result_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_lobby_last_errorfunctionmk_lobby_error mk_lobby_last_error(void)Perform the lobby last error operation.
Returns The resulting value.
mk_lobby_leavefunctionmk_result mk_lobby_leave(mk_lobby_t lobby)Leave and invalidate the handle.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
Returns MK_SUCCESS or an error result.
mk_lobby_list_asyncfunctionmk_result mk_lobby_list_async(const mk_lobby_query_desc *query, mk_lobby_list_fn callback, void *user_data, mk_async_request_t *out_request)Perform the lobby list async operation.
| Parameter | Type | Description |
|---|---|---|
query | const mk_lobby_query_desc * | Value for query. |
callback | mk_lobby_list_fn | Completion callback. |
user_data | void * | Caller-provided context. |
out_request | mk_async_request_t * | Receives the request. |
Returns MK_SUCCESS or an error result.
mk_lobby_member_atfunctionbool mk_lobby_member_at(mk_lobby_t lobby, uint32_t index, mk_lobby_member *out_member)Perform the lobby member at operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
index | uint32_t | Zero-based index. |
out_member | mk_lobby_member * | Receives the member. |
Returns True when the operation succeeds.
mk_lobby_member_countfunctionuint32_t mk_lobby_member_count(mk_lobby_t lobby)Perform the lobby member count operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
Returns The resulting value.
mk_lobby_pollfunctionuint32_t mk_lobby_poll(uint32_t max_events)Deliver pending lobby events and request completions.
Unlike services, this is app-driven: lobby events are gameplay-affecting and belong inside your own state machine. Returns the number of callbacks delivered; max_events of zero drains everything ready.
| Parameter | Type | Description |
|---|---|---|
max_events | uint32_t | Value for max events. |
Returns The resulting value.
mk_lobby_query_desc_initfunctionvoid mk_lobby_query_desc_init(mk_lobby_query_desc *desc)Query desc init for the lobby.
| Parameter | Type | Description |
|---|---|---|
desc | mk_lobby_query_desc * | Configuration descriptor. |
mk_lobby_set_datafunctionmk_result mk_lobby_set_data(mk_lobby_t lobby, const char *key, const char *value)Set data on the lobby.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
key | const char * | Value for key. |
value | const char * | Value to use. |
Returns MK_SUCCESS or an error result.
mk_lobby_set_member_datafunctionmk_result mk_lobby_set_member_data(mk_lobby_t lobby, const char *key, const char *value)Writes only your own row, which is the rule every backend enforces.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
key | const char * | Value for key. |
value | const char * | Value to use. |
Returns MK_SUCCESS or an error result.
mk_lobby_show_invite_uifunctionmk_result mk_lobby_show_invite_ui(mk_lobby_t lobby)Perform the lobby show invite UI operation.
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
Returns MK_SUCCESS or an error result.
mk_lobby_shutdownfunctionvoid mk_lobby_shutdown(void)Perform the lobby shutdown operation.
mk_lobby_startfunctionmk_result mk_lobby_start(mk_lobby_t lobby, const mk_lobby_connect_info *info)Host only: publish where gameplay traffic should connect.
Every member then receives MK_LOBBY_EVENT_GAME_STARTED and can read the same details with mk_lobby_connect_info_get().
| Parameter | Type | Description |
|---|---|---|
lobby | mk_lobby_t | Value for lobby. |
info | const mk_lobby_connect_info * | Value for info. |
Returns MK_SUCCESS or an error result.
mk_lobby_take_pending_joinfunctionbool mk_lobby_take_pending_join(char *out_lobby_id, size_t capacity)Consume a lobby id delivered before the app was ready, as when an invite launched the process.
Returns true once, then false.
| Parameter | Type | Description |
|---|---|---|
out_lobby_id | char * | Receives the lobby ID. |
capacity | size_t | Value for capacity. |
Returns True when the operation succeeds.
mk_lobby_validfunctionbool mk_lobby_valid(mk_lobby_t handle)Perform the lobby valid operation.
| Parameter | Type | Description |
|---|---|---|
handle | mk_lobby_t | Value for handle. |
Returns True when the operation succeeds.
mk_lobby_connect_infostructWhere gameplay traffic should connect once the host starts the session.
The lobby does not carry gameplay traffic. Non-hosts pass url to mk_host_connect_url(), or host/port to mk_host_connect().
| Field | Type | Description |
|---|---|---|
struct_size | uint32_t | The struct size. |
struct_version | uint32_t | The struct version. |
host | char | The host. |
port | uint16_t | The port. |
url | char | The URL. |
host_player_id | char | The host player ID. |
session_nonce | uint64_t | Host-generated join token, if the app uses one. |
mk_lobby_create_descstructData for lobby create desc.
| Field | Type | Description |
|---|---|---|
struct_size | uint32_t | The struct size. |
struct_version | uint32_t | The struct version. |
visibility | mk_lobby_visibility | The visibility. |
max_members | uint32_t | The max members. |
data | const mk_lobby_kv * | Applied as the lobby is created. |
data_count | uint32_t | The data count. |
mk_lobby_descstructData for lobby desc.
| Field | Type | Description |
|---|---|---|
struct_size | uint32_t | The struct size. |
struct_version | uint32_t | The struct version. |
preferred_backend | mk_lobby_backend | The preferred backend. |
server_url | const char * | ws:// or wss:// room server for the SERVER backend. |
event_fn | mk_lobby_event_fn | The event. |
event_user_data | void * | The event user data. |
mk_lobby_errorstructDetail carried alongside mk_result.
mk_result has no NOT_FOUND, TIMEOUT, or NETWORK value, so lobby failures map onto the closest mk_result and carry the real reason here the same split mk_net_error uses.
| Field | Type | Description |
|---|---|---|
code | mk_lobby_error_code | The code. |
platform_code | int32_t | The platform code. |
message | char | The message. |
mk_lobby_eventstructData for lobby event.
| Field | Type | Description |
|---|---|---|
type | mk_lobby_event_type | The type. |
lobby | mk_lobby_t | The lobby. |
lobby_id | char | Set for JOIN_REQUESTED, where lobby is invalid. |
member | mk_lobby_member | The member. |
error | mk_lobby_error | The error. |
mk_lobby_handlestructData for lobby handle.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_lobby_kvstructData for lobby kv.
| Field | Type | Description |
|---|---|---|
key | char | The key. |
value | char | The value. |
mk_lobby_memberstructData for lobby member.
| Field | Type | Description |
|---|---|---|
player_id | char | The player ID. |
display_name | char | The display name. |
is_host | bool | The is host. |
mk_lobby_query_descstructData for lobby query desc.
| Field | Type | Description |
|---|---|---|
struct_size | uint32_t | The struct size. |
struct_version | uint32_t | The struct version. |
filters | const mk_lobby_kv * | Exact string matches on lobby data. |
filter_count | uint32_t | The filter count. |
min_slots_available | uint32_t | The min slots available. |
max_results | uint32_t | The max results. |
mk_lobby_summarystructData for lobby summary.
| Field | Type | Description |
|---|---|---|
lobby_id | char | The lobby ID. |
member_count | uint32_t | The member count. |
max_members | uint32_t | The max members. |
data | const mk_lobby_kv * | Valid for the callback only. |
data_count | uint32_t | The data count. |
mk_lobby_backendenumValues for lobby backend.
| Value | Description |
|---|---|
MK_LOBBY_BACKEND_AUTO | Selects auto. |
MK_LOBBY_BACKEND_NONE | Selects none. |
MK_LOBBY_BACKEND_FAKE | In-process; for tests and offline development. |
MK_LOBBY_BACKEND_STEAM | Selects steam. |
MK_LOBBY_BACKEND_SERVER | A room server you host. |
mk_lobby_capabilityenumValues for lobby capability.
| Value | Description |
|---|---|
MK_LOBBY_CAP_CREATE | Selects create. |
MK_LOBBY_CAP_LIST | Public lobby search. |
MK_LOBBY_CAP_STRING_FILTER | Selects string filter. |
MK_LOBBY_CAP_NUMERIC_FILTER | Selects numeric filter. |
MK_LOBBY_CAP_MEMBER_DATA | Selects member data. |
MK_LOBBY_CAP_INVITE_DIRECT | Invite a known player id. |
MK_LOBBY_CAP_INVITE_OVERLAY | Platform invite UI. |
MK_LOBBY_CAP_JOIN_ON_LAUNCH | Invite accepted before the app was ready. |
MK_LOBBY_CAP_CHAT | Reserved; not in this version. |
MK_LOBBY_CAP_RELAY_TRANSPORT | Reserved; always clear today. |
mk_lobby_error_codeenumValues for lobby error code.
| Value | Description |
|---|---|
MK_LOBBY_ERROR_NONE | Selects none. |
MK_LOBBY_ERROR_UNSUPPORTED | Selects unsupported. |
MK_LOBBY_ERROR_NOT_SIGNED_IN | Selects not signed in. |
MK_LOBBY_ERROR_FULL | Selects full. |
MK_LOBBY_ERROR_NOT_FOUND | Selects not found. |
MK_LOBBY_ERROR_BANNED | Selects banned. |
MK_LOBBY_ERROR_NETWORK | Selects network. |
MK_LOBBY_ERROR_TIMEOUT | Selects timeout. |
MK_LOBBY_ERROR_PLATFORM | Selects platform. |
mk_lobby_event_typeenumValues for lobby event type.
| Value | Description |
|---|---|
MK_LOBBY_EVENT_MEMBER_JOINED | Selects member joined. |
MK_LOBBY_EVENT_MEMBER_LEFT | Selects member left. |
MK_LOBBY_EVENT_DATA_CHANGED | Selects data changed. |
MK_LOBBY_EVENT_MEMBER_DATA_CHANGED | Selects member data changed. |
MK_LOBBY_EVENT_HOST_CHANGED | Selects host changed. |
MK_LOBBY_EVENT_GAME_STARTED | Connect info is now readable. |
MK_LOBBY_EVENT_KICKED | The handle is terminal after this. |
MK_LOBBY_EVENT_JOIN_REQUESTED | An invite was accepted; you have NOT joined. |
MK_LOBBY_EVENT_DISCONNECTED | Selects disconnected. |
mk_lobby_visibilityenumValues for lobby visibility.
| Value | Description |
|---|---|
MK_LOBBY_PRIVATE | Invite only. |
MK_LOBBY_FRIENDS | Selects friends. |
MK_LOBBY_PUBLIC | Selects public. |
MK_LOBBY_INVISIBLE | Joinable by id but not listed. |
mk_lobby_backendtypedeftypedef enum mk_lobby_backend mk_lobby_backendValues for lobby backend.
mk_lobby_capabilities_ttypedeftypedef uint64_t mk_lobby_capabilities_tType used for lobby capabilities.
mk_lobby_connect_infotypedeftypedef struct mk_lobby_connect_info mk_lobby_connect_infoWhere gameplay traffic should connect once the host starts the session.
The lobby does not carry gameplay traffic. Non-hosts pass url to mk_host_connect_url(), or host/port to mk_host_connect().
mk_lobby_create_desctypedeftypedef struct mk_lobby_create_desc mk_lobby_create_descData for lobby create desc.
mk_lobby_desctypedeftypedef struct mk_lobby_desc mk_lobby_descData for lobby desc.
mk_lobby_errortypedeftypedef struct mk_lobby_error mk_lobby_errorDetail carried alongside mk_result.
mk_result has no NOT_FOUND, TIMEOUT, or NETWORK value, so lobby failures map onto the closest mk_result and carry the real reason here the same split mk_net_error uses.
mk_lobby_error_codetypedeftypedef enum mk_lobby_error_code mk_lobby_error_codeValues for lobby error code.
mk_lobby_eventtypedeftypedef struct mk_lobby_event mk_lobby_eventData for lobby event.
mk_lobby_event_fntypedeftypedef void(*) mk_lobby_event_fn(const mk_lobby_event *event, void *user_data)Lobby state change.
Delivered from mk_lobby_poll(); valid for the call only.
mk_lobby_event_typetypedeftypedef enum mk_lobby_event_type mk_lobby_event_typeValues for lobby event type.
mk_lobby_kvtypedeftypedef struct mk_lobby_kv mk_lobby_kvData for lobby kv.
mk_lobby_list_fntypedeftypedef void(*) mk_lobby_list_fn(mk_async_request_t request, mk_result result, const mk_lobby_error *error, const mk_lobby_summary *lobbies, uint32_t count, void *user_data)Callback used for lobby list.
mk_lobby_membertypedeftypedef struct mk_lobby_member mk_lobby_memberData for lobby member.
mk_lobby_query_desctypedeftypedef struct mk_lobby_query_desc mk_lobby_query_descData for lobby query desc.
mk_lobby_result_fntypedeftypedef void(*) mk_lobby_result_fn(mk_async_request_t request, mk_result result, const mk_lobby_error *error, mk_lobby_t lobby, void *user_data)Callback used for lobby result.
mk_lobby_summarytypedeftypedef struct mk_lobby_summary mk_lobby_summaryData for lobby summary.
mk_lobby_ttypedeftypedef struct mk_lobby_handle mk_lobby_tData for lobby handle.
mk_lobby_visibilitytypedeftypedef enum mk_lobby_visibility mk_lobby_visibilityValues for lobby visibility.
MK_LOBBY_CONNECT_INFO_VERSIONdefineMK_LOBBY_CONNECT_INFO_VERSIONABI or format version for lobby connect info.
MK_LOBBY_CREATE_DESC_VERSIONdefineMK_LOBBY_CREATE_DESC_VERSIONABI or format version for lobby create desc.
MK_LOBBY_DESC_VERSIONdefineMK_LOBBY_DESC_VERSIONABI or format version for lobby desc.
MK_LOBBY_INVALIDdefineMK_LOBBY_INVALIDInvalid sentinel for lobby.
MK_LOBBY_MAX_IDdefineMK_LOBBY_MAX_IDMaximum supported lobby ID.
MK_LOBBY_MAX_KEYdefineMK_LOBBY_MAX_KEYMaximum supported lobby key.
MK_LOBBY_MAX_NAMEdefineMK_LOBBY_MAX_NAMEMaximum supported lobby name.
MK_LOBBY_MAX_VALUEdefineMK_LOBBY_MAX_VALUEMaximum supported lobby value.
MK_LOBBY_QUERY_DESC_VERSIONdefineMK_LOBBY_QUERY_DESC_VERSIONABI or format version for lobby query desc.