### App Build VDF Depot List Example Source: https://kb.heathen.group/steam/deploy.md An example of how to list multiple depot build configurations within the app build VDF. This section specifies which depot build files are included in the application build. ```json "depots" { "123456" "depot_build_123456.vdf", "234567" "depot_build_234567.vdf" } ``` -------------------------------- ### Leaderboard Task (Blueprint) Source: https://kb.heathen.group/steam/features/leaderboards.md Example of a task setup within Blueprint for leaderboard operations. ```blueprint GetLeaderboardTask ``` -------------------------------- ### Install DLC in C++ Source: https://kb.heathen.group/steam/features/downloadable-content.md Initiate the installation of a specific DLC using its App ID. This is a request; Steam will handle the actual download and installation. ```cpp SteamApps()->InstallDLC(appId); ``` -------------------------------- ### Find and Download Installed Workshop Content (C#) Source: https://kb.heathen.group/steam/features/workshop.md Use this C# code to query for subscribed Steam Workshop items, check their installation status, and initiate downloads if necessary. It also shows how to monitor download progress and access the content's folder path. ```csharp // Get a query for the subscribed items var query = UgcQuery.GetSubscribed(); // Run the query query.Execute(HandleResults); // Handle the results void HandleResults(UgcQuery query) { // Iterate over the found items foreach (var result in query.ResultsList) { // Check if its installed and download if needed if (!result.IsInstalled) result.DownloadItem(true); // Check if this item is downloading or going to download if (result.IsDownloading || result.IsDownloadPending) ;// handle download in progress // Monitor how much is downloaded float percentComplete = result.DownloadCompletion; // The location where the content is downloaded to result.FolderPath } } ``` -------------------------------- ### Get All Internet Servers (Unity) Source: https://kb.heathen.group/steam/features/steam-game-server.md Call this method from your code to initiate a search for all available internet servers. Ensure the GameServerBrowserManager is properly initialized. ```csharp gameServerBrowserManager.GetAllInternet(); ``` -------------------------------- ### C++ Lobby Creation with Callbacks Source: https://kb.heathen.group/steam/features/lobby.md This C++ example demonstrates how to create a lobby using the Steamworks SDK. It involves setting up a callback to handle the result of the lobby creation and dispatching it to the game thread. ```cpp // You will need to declare your callback such as CCallResult m_LobbyCreate_t; // Then call create lobby which will return a SteamAPICall_t handle that can be used // to set the m_LobbyCreate_t callback. SteamAPICall_t handle = SteamMatchmaking()->CreateLobby(static_cast(type), maxMembers); m_LobbyCreate_t.Set(handle, this, &YourClassName::SteamCallback); // The SteamCallback is a function that will be invoked by the callback YourClassName::SteamCallback(LobbyCreated_t* Response, bool bIOError) { // Unreal runs callbacks on a seperate thread so you may need to dispatch the result // to your game thread FGraphEventRef GameThreadTask = FFunctionGraphTask::CreateAndDispatchWhenReady([this, bIOError, Response]() { if (!bIOError) { // Callback in this context would simply be a delegate on your game thread if (Callback.IsBound()) Callback.Execute(static_cast(Response->m_eResult), static_cast(Response->m_ulSteamIDLobby)); } else { if (Callback.IsBound()) Callback.Execute(UEResult::EPC_IOFailure, 0); } }, TStatId(), nullptr, ENamedThreads::GameThread); GameThreadTask->Wait(); delete this; } ``` -------------------------------- ### Query Documentation with Ask Parameter Source: https://kb.heathen.group/steam Perform an HTTP GET request to the documentation index with the `ask` parameter for a specific question and an optional `goal` parameter to tailor the answer. This is the recommended method for retrieving specific information. ```http GET https://kb.heathen.group/helping-heathen-do-more.md?ask=&goal= ``` -------------------------------- ### Start Item Purchase in C# Source: https://kb.heathen.group/steam/features/inventory.md Initiates the purchase process for a specified quantity of an item. Ensure the item is valid for purchase and has a price. The callback provides transaction details upon successful initiation. ```csharp // Assuming ItemData myItem = 100; // or ItemDefinitionObject myItem; // Drag and drop in the inspector // Assuming myItem is valid for purchase (has a price, is not blocked or hidden) // How many to buy? uint count = 1; myItem.StartPurcahse(count, (result, ioError) => { if(!ioError && result.m_result == EResult.k_EResultOK) { ulong OrderId = result.m_ulOrderID; ulong TransactionId = result.m_ulTransID; } }); ``` -------------------------------- ### Get Item Prices in C# Source: https://kb.heathen.group/steam/features/inventory.md Demonstrates how to retrieve current and base prices for an item. Ensure prices are requested before accessing them. The currency symbol is also accessible. ```csharp // Assuming ItemData myItem = 100; // or ItemDefinitionObject myItem; // Drag and drop in the inspector // Before you work with prices, be sure to request the prices // This is normally done for you on initialisation // but be sure ItemData.RequestPrices((result, ioError) => { // if result.m_result is okay and ioError is false, all is well }); // get the current and base price (base price is before sales/promos) myItem.GetPrice(out ulong currentPrice, out ulong basePrice); // get the current price as a human-friendly string ... this assumes // the currency is based on 100 (USD, GBP, Euro, etc.) string price = myItem.CurrentPriceString(); // and the same for base price string basePrice = myItem.BasePriceString(); // Do you just need the currency symbol? .. e.g. $, €, £, etc string symbol = ItemData.CurrencySymbol; ``` -------------------------------- ### Calling Steam Matchmaking Server List Functions Source: https://kb.heathen.group/steam/features/steam-game-server.md Example of how to call a specific server list request function, such as RequestInternetServerList. This requires an AppId, filters, and a response object. ```csharp API.Matchmaking.Client.RequestInternetServerList(appId, filters, m_ServerListResponse) ``` -------------------------------- ### Get Command Line Lobby (C#) Source: https://kb.heathen.group/steam/features/lobby.md Retrieves a lobby from the command line using the Matchmaking client. Use this when the game is in an appropriate state to join the lobby. ```csharp LobbyData targetLobby = Matchmaking.Client.GetCommandLineConnectLobby(); if(targetLobby.IsValid) { // A lobby was found on the command line. You should join it. // when the game is in an appropriate state. } ``` -------------------------------- ### Define Steam Project IDs in Target.cs Source: https://kb.heathen.group/steam/configuration/unreal-configuration.md Configure project-specific Steam identifiers and descriptions within the Target.cs file. This example shows how to set the shipping ID, game description, directory name, and product name. ```csharp public TuathaLegendsTarget(TargetInfo Target) : base(Target) { Type = TargetType.Game; DefaultBuildSettings = BuildSettingsVersion.V5; IncludeOrderVersion = EngineIncludeOrderVersion.Latest; //Set our app id ProjectDefinitions.Add("UE_PROJECT_STEAMSHIPPINGID=1024120"); //Set our human-friendly name ProjectDefinitions.Add("UE_PROJECT_STEAMGAMEDESC=Túatha: Legends"); //Set our directory name ProjectDefinitions.Add("UE_PROJECT_STEAMGAMEDIR=TuathaLegends"); //Set the product name ProjectDefinitions.Add("UE_PROJECT_STEAMPRODUCTNAME=1024120"); //Add our module name ExtraModuleNames.AddRange( new string[] { "TuathaLegends" } ); } ``` -------------------------------- ### Invite User to Game (C#) Source: https://kb.heathen.group/steam/features/user.md This C# snippet demonstrates how to invite a friend to your game using Steamworks.NET. It also includes setup for handling the Rich Presence callback when a friend accepts an invite while already in-game. ```csharp //Assume CSteamID userId; //=Is the friend to invite string connectString; //=Is the connection string to send them SteamFriends.InviteUserToGame(userId, connectString); ``` ```csharp //Declare the callback somewhere safe Callback m_RPJoinRequested_t; //Don't forget to "create" it, pointing it at a function to call when invoked m_RPJoinRequested_t = Callback.Create(HandlerFunction); ``` ```csharp void HandlerFunciton(GameRichPresenceJoinRequested_t arg0) { // arg0.m_steamIDFriend is the friend who invited you // arg0.m_rgchConnect is the connection string they sent } ``` -------------------------------- ### Fetch Game Server Build using SteamCMD Source: https://kb.heathen.group/steam/features/steam-game-server.md Use this command to download your game server application from Steam depots. Replace with your actual Steam App ID. ```bash steamcmd +login anonymous \ +force_install_dir /path/to/server_build \ +app_update validate \ +quit ``` -------------------------------- ### Get User Session Ticket (Steamworks.NET) Source: https://kb.heathen.group/steam/features/authentication.md Obtain a user's authentication session ticket using Steamworks.NET. This example shows how to manage the buffer and retrieve the ticket handle. ```csharp // A temp buffer to hold the max value var array = new byte[1024]; // Will tell us the actual length uint m_pcbTicket; // Retain the handle for later use var Handle = SteamUser.GetAuthSessionTicket(array, 1024, out m_pcbTicket, ref forIdentity); // Trim the array to match the actual size Array.Resize(ref array, (int)m_pcbTicket); ``` -------------------------------- ### Begin Steam Auth Session and Callback Handler (C#) Source: https://kb.heathen.group/steam/features/authentication.md Demonstrates how to initiate a Steam authentication session and handle the callback response using Steamworks.NET. Ensure the callback is registered permanently. ```csharp // Register the callback somewhere permanent if you haven't already m_ValidateAuthSessionTicketResponse = Callback.Create(HandleValidateAuthTicketResponse); // To begin the session byte[] authTicket; // This would be passed in by the user you're authenticating var Result = SteamUser.BeginAuthSession(authTicket, authTicket.Length, user); // The handler for your callback will take the form of private void HandleValidateAuthTicketResponse(ValidateAuthTicketResponse_t arg0) { if (arg0.m_eAuthSessionResponse != EAuthSessionResponse.k_EAuthSessionResponseOK) ;// Something is wrong with the ticket, the session response will say what } ``` -------------------------------- ### Configure Local Testing with steam_appid.txt Source: https://kb.heathen.group/steam/build-testing.md Place this file in your game's root directory for local testing. It must contain only your game's App ID as plain text. ```text steam_appid.txt Contents: 123456 ``` -------------------------------- ### Get Specific Item Quantity C# Source: https://kb.heathen.group/steam/features/inventory.md After handling inventory updates, use ItemData to check quantities of specific items. This example retrieves the total quantity for item ID 100. ```csharp ItemData myItem = 100; Debug.Log($"The player has {myItem.GetTotalQuantity()} of item ID 100"); ``` -------------------------------- ### C# Leaderboard Entry Retrieval Source: https://kb.heathen.group/steam/features/leaderboards.md Provides C# examples for fetching leaderboard entries. Use these methods to get top entries, entries for specific users, entries around a user, or entries for all friends. The final parameter is a delegate called upon completion. ```csharp //You have several quality-of-life shortcuts to reading records in different ways //In all cases, the final parameter is a delegate that will be called when the //process completes and will contain the results found if any. //Top X number of records int howMany = 42; int detailsCount = 0; SteamTools.Game.Leaderboards.Feet_Traveled.GetTopEntries(howMany, detailsCount, (entriesFound, ioError) => { //Handle the entries found if ioError is false }); //Get entries for specific users UserData[] users; //set this to who you want to read for int detailsCount = 0; SteamTools.Game.Leaderboards.Feet_Traveled.GetEntries(users, detailsCount, (entriesFound, ioError) => { //Handle the entries found if ioError is false }); //Get entries around the user's entry (includes the user's entry) int beforeUser = -5; int afterUser = 5; int detailsCount = 0; SteamTools.Game.Leaderboards.Feet_Traveled.GetEntries(ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobalAroundUser, beforeUser, afterUser, detailsCount, (entriesFound, ioError) => { //Handle the entries found if ioError is false }); //Get all your friends' entries int detailsCount = 0; SteamTools.Game.Leaderboards.Feet_Traveled.GetEntries(ELeaderboardDataRequest.k_ELeaderboardDataRequestFriends, 0, 0, detailsCount, (entriesFound, ioError) => { //Handle the entries found if ioError is false }); //Get all entries ... really not recommended but it exists int detailsCount = 0; SteamTools.Game.Leaderboards.Feet_Traveled.GetAllEntries(detailsCount, (entriesFound, ioError => { //Handle the entries found if ioError is false })); ``` -------------------------------- ### Initializing ISteamMatchmakingServerListResponse Source: https://kb.heathen.group/steam/features/steam-game-server.md Shows how to instantiate the ISteamMatchmakingServerListResponse callback object with specific handler methods for server responses, failures, and refresh completion. ```csharp m_ServerListResponse = new ISteamMatchmakingServerListResponse(OnServerResponded, OnServerFailedToRespond, OnRefreshComplete); ``` -------------------------------- ### Check DLC Installation Status in C++ Source: https://kb.heathen.group/steam/features/downloadable-content.md Verify if a specific DLC is currently installed on the user's system using its App ID. ```cpp bool result = SteamApps()->BIsDlcInstalled(appId); ``` -------------------------------- ### Example Success Message for Master Server Heartbeat Source: https://kb.heathen.group/steam/features/steam-game-server.md This is an example of a successful heartbeat message from a game server to Steam's master servers. It indicates that the server is registered and reachable. ```text [GameServer] Sent heartbeat to master servers; response: OK ``` -------------------------------- ### Invite User to Game (C++) Source: https://kb.heathen.group/steam/features/user.md Use this C++ snippet to invite a user to your game. It also shows how to retrieve a connection string from the command line if the user is not already in-game. ```cpp //Assuming CSteamID userId; //= who to invite FString connectionString; //= where to send them //To send the connection string SteamFriends()->InviteUserToGame(steamId, StringCast(*connectionString).Get()); //To get the connection string from the command line FString ConnectString; // FParse::Value will search the command line for "connect=" and extract its value. if (FParse::Value(FCommandLine::Get(), TEXT("connect="), ConnectString)) { UE_LOG(LogTemp, Log, TEXT("Connection string found: %s"), *ConnectString); // Use ConnectString to join the game session or perform further processing. } else { UE_LOG(LogTemp, Log, TEXT("No connection string found.")); } ``` -------------------------------- ### Steam Rich Presence Localization Tokens Example Source: https://kb.heathen.group/steam/features/rich-presence.md Example of Rich Presence language tokens used in Valve's documents, defining various game statuses and score displays. ```json "lang" { "Language" "english" "Tokens" { "#StatusWithoutScore" "{#Status_%gamestatus%}" "#StatusWithScore" "{#Status_%gamestatus%}: %SCORE%" "#Status_AtMainMenu" "At the main menu" "#Status_WaitingForMatch" "Waiting for match" "#Status_Winning" "Winning" "#Status_Losing" "Losing" "#Status_Tied" "Tied" } } ``` -------------------------------- ### Get User Data in Steamworks.NET Source: https://kb.heathen.group/steam/features/user.md Retrieves the persona name for the local user or another user via their ID. Handles avatar image retrieval by first getting a handle and then loading the RGBA data into a byte array. ```csharp //Get the local user's name string name = SteamFriends.GetPersonaName(); //Get another user's name string name = SteamFriends.GetFriendPersonaName(userId); //To get the user's avatar image, it is a two-step process //First, get the handle int32 handle = SteamFriends.GetLargeFriendAvatar(userId); //Set up buffers to hold the data int bufferSize = (int)(width * height * 4); byte[] imageBuffer = new byte[bufferSize]; //Load and use the data if (SteamUtils.GetImageRGBA(imageHandle, imageBuffer, bufferSize)) { //Now use it how you like } ``` -------------------------------- ### Get All Items - Task Blueprint Source: https://kb.heathen.group/steam/features/inventory.md The Get All Items - Task is an asynchronous Blueprint node that executes the Completed pin upon receiving a response from Steam. The Result pin indicates the call status, and Items contains the found items. -------------------------------- ### Run SteamCMD Build Script Source: https://kb.heathen.group/steam/deploy.md This batch script logs into SteamCMD and initiates the app build process using a specified VDF script. Replace placeholders with your Steam credentials and App ID. ```batch builder\steamcmd.exe +login [Username] [Password] +run_app_build_http ..\scripts\app_build_[appid].vdf +quit pause ``` -------------------------------- ### Activate Web Page in C# Source: https://kb.heathen.group/steam/features/overlay.md Use this C# method to open a specified URL in the Steam overlay browser. Ensure the Overlay.Client is properly initialized. ```csharp Overlay.Client.ActivateWebPage(url); ``` -------------------------------- ### Get Item Quantity (C# SDK) Source: https://kb.heathen.group/steam/features/inventory.md Retrieves the total quantity of a specific item. ```APIDOC ## Get Total Quantity (ItemData) ### Description Gets the total quantity of a specific item using its ID. ### Method `myItem.GetTotalQuantity()` ### Parameters - `myItem` (ItemData): An instance of ItemData representing the item. ### Request Example ```csharp ItemData myItem = 100; Debug.Log($ ``` ```APIDOC ## Get Total Quantity (Inventory.Client) ### Description Gets the total quantity of a specific item using its ID. ### Method `Inventory.Client.ItemTotalQuantity(itemId)` ### Parameters - `itemId` (long): The ID of the item to query. ### Request Example ```csharp long quantity = Inventory.Client.ItemTotalQuantity(100); Debug.Log($"The player has {quantity} of item ID 100"); ``` ``` -------------------------------- ### Begin Steam Auth Session (C++) Source: https://kb.heathen.group/steam/features/authentication.md Initiates a Steam authentication session using Unreal Engine's Steam Tools Subsystem. Assumes the input ticket is a TArray and converts it to a uint8 array for Steam. ```cpp USteamToolsSubsystem* Subsystem = GEngine->GetWorld()->GetGameInstance()->GetSubsystem(); FBeginAuthSessionCallbackDelegate callback; callback.BindUFunction(this, FName("SteamCallback")); Subsystem->BeginAuthRequests.Add(Request.User, callback); int32 TicketLength = Ticket.Num(); const uint8* TicketData = Ticket.GetData(); EBeginAuthSessionResult result = SteamUser()->BeginAuthSession(TicketData, TicketLength, INT64_TO_STEAMID(Request.User)); ``` -------------------------------- ### Get Lobby Members (C++) Source: https://kb.heathen.group/steam/features/lobby.md Retrieves all members of a specified lobby. Ensure you are a member of the lobby for this function to work. ```cpp // The lobby you want to read for, you must be a member of it for this to work CSteamID LobbyID; int32 Count = SteamMatchmaking()->GetNumLobbyMembers(LobbyID); TArray Result; Result.SetNum(Count); for (int32 i = 0; i < Count; i++) { Result[i] = SteamMatchmaking()->GetLobbyMemberByIndex(LobbyID, i); } ``` -------------------------------- ### Initialize Remote Play and Handle Session Connection (Unity C#) Source: https://kb.heathen.group/steam/features/remote-play.md Register a listener for the session connected event and send an invite to a user. Store the session ID when a guest connects to reference them in subsequent API calls. Retrieve user data, client name, form factor, and resolution for the connected session. ```csharp // Be ready to listen when they accept RemotePlay.Client.EventSessionConnected.AddListener(HandleSessionConnected); // To invite a player if (RemotePlay.Client.SendInvite(User)) Debug.Log("Done"); else Debug.Log("Send failed"); ``` ```csharp private void HandleSessionConnected(SteamRemotePlaySessionConnected_t Callback) { // You should store this somewhere as you will use it later. session = Callback.m_unSessionID; // Get the UserData for the connected user UserData user = RemotePlay.Client.GetSessionUser(session); // Get the name of the device the session is playing on string clientName = RemotePlay.Client.GetSessionClientName(session); // Get the form factor the session is playing in ESteamDeviceFormFactor formFactor = RemotePlay.Client.GetSessionClientFormFactor(session); //Get the resolution the session is playing at Vector2Int resolution = RemotePlay.Client.GetSessionClientResolution(session); } ``` -------------------------------- ### Leaderboard Callback (Blueprint) Source: https://kb.heathen.group/steam/features/leaderboards.md Demonstrates classic callback style options for leaderboard interactions in Blueprint. ```blueprint GetLeaderboard ``` -------------------------------- ### Get DLC Count in C++ Source: https://kb.heathen.group/steam/features/downloadable-content.md Retrieve the total number of DLC available for the current application. This is useful for iterating through all DLCs. ```cpp int32 count = SteamApps()->GetDLCCount(); ``` -------------------------------- ### Get Lobby Members (C#) Source: https://kb.heathen.group/steam/features/lobby.md Retrieves all members of a specified lobby using Steamworks.NET. Initializes an array to hold the member IDs. ```csharp // Get the member count int count = SteamMatchmaking.GetNumLobbyMembers(lobby); // Initalize an array to hold the IDs CSteamID[] results = new CSteamID[count]; for (int i = 0; i < count; i++) results[i] = SteamMatchmaking.GetLobbyMemberByIndex(lobby, i); ``` -------------------------------- ### Handle Add Promo Results in Unity Source: https://kb.heathen.group/steam/features/inventory.md Implement event handlers for the results of the Add Promo function, including rejected, failed, and completed states. ```unity You can use these events: To handle the results of the Add Promo function. ### On Add Promo Rejected This is raised in response to: It indicates a direct rejection of the request by Steam. No further action will be taken. ### On Add Promo Failed This is raised in response to: It occurs when the request was accepted but then failed in processing on Steam. The EResult value it provides will indicate why it failed. ### On Add Promo Complete This is raised in response to: It occurs when the request was accepted and completed by Steam. The ItemDetrail array it provides is the items effected by the process if any. In generally we would recomend you Get All after any such change to fully refresh the internal view of the inventory. ``` -------------------------------- ### Get Price Source: https://kb.heathen.group/steam/features/inventory.md Retrieves the current price for an item if it has a valid price or price category set. This is useful for implementing in-game shops. ```APIDOC ## Get Price ### Description Requests and retrieves the current price for an item, provided it has a valid price or price category configured. This functionality is particularly useful for creating in-game stores or shops. ### Usage This API allows you to fetch pricing information for items, enabling dynamic display of costs in your game's economy. ``` -------------------------------- ### Unlock Achievement Example Source: https://kb.heathen.group/steam/configuration/unity-configuration.md Demonstrates how to unlock a specific achievement using the SteamTools.Game.Achievements API. Ensure the Steamworks SDK is initialized and the wrapper is generated. ```csharp SteamTools.Game.Achievements.ACH_TRAVEL_FAR_ACCUM.Unlock(); ``` -------------------------------- ### Activate Game Overlay to Store (C++) Source: https://kb.heathen.group/steam/features/overlay.md Use this C++ function to open the Steam store page for a specific application. Requires AppId_t and EOverlayToStoreFlag. ```cpp // For AppId_t AppId // and // EOverlayToStoreFlag Flag SteamFriends()->ActivateGameOverlayToStore(AppId, Flag); ``` -------------------------------- ### Get User Leaderboard Entry (C#) Source: https://kb.heathen.group/steam/features/leaderboards.md Retrieves a specific user's entry from a leaderboard. Handles the found entry if there are no I/O errors. ```csharp SteamTools.Game.Leaderboards.Feet_Traveled.GetUserEntry(detailEntriesCount, (foundEntry, ioError) => { // Handle the found entry if ioError is false }); ``` -------------------------------- ### Get Active Beacons in C# Source: https://kb.heathen.group/steam/features/party.md Retrieves a list of active beacon IDs and their details. Use this to display or manage existing party beacons. ```csharp // Get the list of active beacon IDs. PartyBeaconID_t[] beaconIDs = Parties.Client.GetBeacons(); if (beaconIDs == null || beaconIDs.Length == 0) { Debug.Log("No active beacons found."); return; } Debug.Log("Active beacons count: " + beaconIDs.Length); // Iterate over each beacon ID. foreach (PartyBeaconID_t beaconId in beaconIDs) { // Optionally, get details about the beacon. var beaconDetails = Parties.Client.GetBeaconDetails(beaconId); if (beaconDetails.HasValue) { Debug.Log($"BeaconID: {beaconId} | Owner: {beaconDetails.Value.owner} | Metadata: {beaconDetails.Value.metadata}"); } else { Debug.Log($"BeaconID: {beaconId} - No details available."); } } ``` -------------------------------- ### Get All Items (Unreal Engine Blueprints) Source: https://kb.heathen.group/steam/features/inventory.md Fetches all items in the player's inventory using Blueprint nodes. Supports Task and Simple variations. ```APIDOC ## Get All Items - Task (Blueprint) ### Description An asynchronous Blueprint node that fetches all items in the player's inventory. Executes the 'Completed' pin upon receiving results from Steam. ### Method `Get All Items - Task` ### Parameters - `Optional Custom Properties` (array of strings): An optional array of custom property names to retrieve for each item. ### Response - `Result` (EResult): An enumerator describing the status of the call. - `Items` (array of Item Details): An array containing the items found, including their properties if requested. ``` ```APIDOC ## Get All Items - Simple (Blueprint) ### Description Invokes an event when the inventory results are ready. This node simplifies the process by handling callbacks internally, similar to the native Steamworks SDK but with packaged results. ### Method `Get All Items - Simple` ### Parameters - `Optional Custom Properties` (array of strings): An optional array of custom property names to retrieve for each item. ### Response - `Result` (EResult): An enumerator describing the status of the call. - `Items` (array of Item Details): An array containing the items found, including their properties if requested. ``` -------------------------------- ### Initialize and Dispose Input System (Unity) Source: https://kb.heathen.group/steam/features/input.md Initialize the Steam Input system by calling RunFrame on start. In Unity Editor, force Steam client to use your app's input settings. Dispose by forcing the Steam client to use default settings. ```csharp API.Input.Client.RunFrame(); Application.OpenURL($"steam://forceinputappid/{SteamSettings.ApplicationId}"); // When done: Application.OpenURL("steam://forceinputappid/0"); ``` -------------------------------- ### Create Beacon in Unity Source: https://kb.heathen.group/steam/features/party.md Use this C# code to create a party beacon in Unity. Ensure Steam and the Parties system are initialized before calling this function. It retrieves available locations, sets join details and metadata, and then creates the beacon. ```csharp public void CreateBeacon() { // Make sure Steam and the Parties system are initialized. // Retrieve the list of available beacon locations. SteamPartyBeaconLocation_t[] availableLocations = Parties.Client.GetAvailableBeaconLocations(); if (availableLocations == null || availableLocations.Length == 0) { Debug.LogWarning("No available beacon locations found."); return; } // Select a beacon location (using the first one for this example). SteamPartyBeaconLocation_t selectedLocation = availableLocations[0]; // Set up the join string which provides connection details to joining players. string joinString = "JoinGameSessionToken123"; // Set metadata (for example, game mode or map details). string metadata = "GameMode=Deathmatch;Map=Arena"; // Set the number of open slots (e.g., if the host takes one slot and three open slots remain). uint openSlots = 3; // Create a beacon using your custom API. Parties.Client.CreateBeacon(openSlots, ref selectedLocation, joinString, metadata, OnCreateBeacon); } ``` ```csharp private void OnCreateBeacon(CreateBeaconCallback_t result, bool ioFailure) { if (ioFailure) { Debug.LogError("I/O Failure occurred while creating beacon."); return; } // Check if the creation was successful. if (result.m_eResult == EResult.k_EResultOK) { Debug.Log("Beacon created successfully. Beacon ID: " + result.m_ulBeaconID); } else { Debug.LogError("Failed to create beacon. Steam error: " + result.m_eResult); } } ``` -------------------------------- ### Get User Session Ticket (C#) Source: https://kb.heathen.group/steam/features/authentication.md Obtain an authentication session ticket for a user or game server. The ticket can then be sent to a network host for verification. ```csharp UserData networkHost; Authentication.GetAuthSessionTicket(networkHost, (TicketResponse, IOError) => { if(!IOError && TicketResponse.Result == EResult.k_EResultOK) { // Send TicketResponse.Data to your networkHost to use } }); ``` -------------------------------- ### Get Active Beacons in Steamworks.NET Source: https://kb.heathen.group/steam/features/party.md Retrieves the count and details of active beacons using Steamworks.NET. This is useful for iterating through and displaying party beacon information. ```csharp // Get the count of active beacons. uint beaconCount = SteamParties.GetNumActiveBeacons(); if (beaconCount == 0) { Debug.Log("No active beacons found."); return; } Debug.Log("Active beacons count: " + beaconCount); // Loop through the beacons using their index. for (uint i = 0; i < beaconCount; i++) { // Retrieve the beacon ID using its index. PartyBeaconID_t beaconID = SteamParties.GetBeaconByIndex(i); // Retrieve beacon details: owner, location, and metadata. if (SteamParties.GetBeaconDetails(beaconID, out CSteamID owner, out SteamPartyBeaconLocation_t location, out string metadata, 8193)) { Debug.Log($"BeaconID: {beaconID} | Owner: {owner} | Metadata: {metadata}"); } else { Debug.Log($"BeaconID: {beaconID} - No details available."); } } ``` -------------------------------- ### Get Voice Data (Unity) Source: https://kb.heathen.group/steam/features/voice.md This C# code snippet is a placeholder for Unity's voice recording functionality. It indicates that the implementation is 'Coming Soon'. ```csharp Coming Soon ``` -------------------------------- ### Read User Stat for Game Servers (Int) Source: https://kb.heathen.group/steam/features/stats.md Steam Game Servers can read stats for users after authentication. This example shows how to retrieve a stat as an integer. ```csharp // Steam Game Servers can read stats for users CSteamID userId = new(); // This is just a stand-in for the ID of the user you want to read for // First, the server must request the user's stats, which can only be done after authentication StatsAndAchievements.Server.RequestUserStats(userId, HandleStatsReceived); // When the HandleStatsReceived has completed, you can then read the stat values // Get the value as an int StatsAndAchievements.Server.GetUserStat(userId, "API_NameHere", out int intValue); ``` -------------------------------- ### Upload Server Build with ContentBuilder Source: https://kb.heathen.group/steam/features/steam-game-server.md Use ContentBuilder to upload compiled server binaries and configuration files to SteamPipe. Ensure depot_build.vdf includes all necessary files and a steam_appid.txt. ```bash ContentBuilder.exe +login \ +run_app_build \ +quit ``` -------------------------------- ### Read User Stat for Game Servers (Float) Source: https://kb.heathen.group/steam/features/stats.md Steam Game Servers can read stats for users after authentication. This example shows how to retrieve a stat as a float. ```csharp // Steam Game Servers can read stats for users CSteamID userId = new(); // This is just a stand-in for the ID of the user you want to read for // First, the server must request the user's stats, which can only be done after authentication StatsAndAchievements.Server.RequestUserStats(userId, HandleStatsReceived); // When the HandleStatsReceived has completed, you can then read the stat values // Get the value as a float StatsAndAchievements.Server.GetUserStat(userId, "API_NameHere", out float floatValue); ``` -------------------------------- ### Activate Invite Dialog (C#) Source: https://kb.heathen.group/steam/features/overlay.md Use this function to open the invite dialog. You can pass a connection string to join a game session or LobbyData to invite to a specific lobby. ```csharp Overlay.Client.ActivateInviteDialog(target); ``` -------------------------------- ### Serialize and Deserialize Inventory Data in C# Source: https://kb.heathen.group/steam/features/inventory.md Use SerializeAllItemResults to get all inventory data, or SerializeItemResultsByID for specific items. DeserializeResult on the receiving end to process the data. ```csharp // Get the serialized data for the player's enter inventory Inventory.Client.SerializeAllItemResults(data => { // Send data to the player or server who needs it }); // Get the serialized data for a specific item or items ItemData item = 100; var details = item.GetDetails(); var instance = new SteamItemInstanceID_t[details.Count]; for(int i = 0; i < details.Count; i++) instance[i] = details[i].itemDetails.m_itemId; Inventory.Client.SerializeItemResultsByID(instance, data => { // Send data to the player or server who needs it }); // On the player or server that needed the data Inventory.Client.DeserializeResult(whoSentIt, data, response => { if(response.result == EResult.k_EResultOK) { // whoSentIt defently owns these items response.items // <- } }); ``` -------------------------------- ### Upload, Share, and Attach UGC to Leaderboard (C++) Source: https://kb.heathen.group/steam/features/leaderboards.md This C++ snippet demonstrates the asynchronous process of writing a file to remote storage, sharing it, and then attaching the resulting UGC handle to a specific leaderboard. It requires setting up CallResult entries for each asynchronous operation. ```cpp // First, we need to create our 3 CallResult entries // File Write ASync Complete CCallResult m_RemoteStorageFileWriteAsyncComplete_t; // File Share Complete CCallResult m_RemoteStorageFileShareResult_t; // Next, we need to upload our file data // Assuming FString name; // The file name TArray data; // The data to upload // Then we call the FileWriteAsync SteamAPICall_t handle = SteamRemoteStorage()->FileWriteAsync(StringCast(*name).Get(), data.GetData(), data.Num()); // And set the handle m_RemoteStorageFileWriteAsyncComplete_t.Set(handle, this, &YourClass::WriteComplete); // In your WriteComplete function // This uses the same file name as before void YourClass::WriteComplete(RemoteStorageFileWriteAsyncComplete_t* result, bool ioError) { // Share the new file SteamAPICall_t handle = SteamRemoteStorage()->FileShare(StringCast(*name).Get()); m_RemoteStorageFileShareResult_t.Set(handle, this, &YourClass::ShareComplete); } // This requires you to know the Board ID you want to attach the file to // This is the same ID you got when you "found" or "created" the board // Now in your ShareComplete funciton void YourClass::ShareComplete(RemoteStorageFileShareResult_t* result, bool ioError) { // Attach the share handle to the target board SteamAPICall_t handle = SteamUserStats()->AttachLeaderboardUGC(boardId, result->m_hFile); m_LeaderboardUGCSet_t.Set(handle, this, &YourClass::AttachComplete); } void YourClass::AttachComplete(LeaderboardUGCSet_t* result, bool ioError) { // The process is now complete } ``` -------------------------------- ### Native Style Inventory Fetch (Unreal Engine) Source: https://kb.heathen.group/steam/features/inventory.md Demonstrates how to manually handle inventory result callbacks using native Steamworks SDK patterns. ```APIDOC ## Native Style Inventory Fetch (Blueprint) ### Description This approach involves manually managing result handles and listening for global inventory result events to process inventory data. ### Steps: 1. **Request Items**: Use the native 'Get All Items' function to request items from Steam. This returns a result handle. - `Get All Items` (Blueprint Node) - Returns: `Result Handle` 2. **Listen for Results**: Bind to the global 'Inventory Result Ready' event. - `Inventory Result Ready` (Global Event) - Compares the event's `Result Handle` with the one obtained in step 1. 3. **Read Results**: If the handles match, use the result handle to read the inventory data from Steam. - `Read Inventory Results` (Blueprint Node) - Parameters: `Result Handle` - Returns: `Result` (EResult), `Items` (array of Item Details) ``` -------------------------------- ### Activate Game Overlay Invite Dialog (Unreal Engine) Source: https://kb.heathen.group/steam/features/overlay.md Provides nodes for Blueprint and C++ to invite players to a game or lobby. ```APIDOC ## Activate Game Overlay Invite Dialog (Unreal Engine) ### Description Invites players to a game using a connection string or to a lobby using a Lobby ID. ### Blueprint Provides two nodes for inviting players. ### C++ - For `FString ConnectionString`: `SteamFriends()->ActivateGameOverlayInviteDialogConnectString(StringCast(*ConnectionString).Get());` - For `CSteamID LobbyId`: `SteamFriends()->ActivateGameOverlayInviteDialog(LobbyId);` ``` -------------------------------- ### Get All Items (C# SDK) Source: https://kb.heathen.group/steam/features/inventory.md Retrieves all items in the player's inventory. This can be done using either the ItemData static class or the Inventory.Client static class. ```APIDOC ## Using Inventory.Client ### Description Retrieves all items in the player's inventory. ### Method `Inventory.Client.GetAllItems(HandleInventoryUpdate)` ### Parameters - `HandleInventoryUpdate` (delegate): A callback function that will be invoked with the inventory results. ### Request Example ```csharp Inventory.Client.GetAllItems(HandleInventoryUpdate); ``` ### Response The `HandleInventoryUpdate` delegate receives an `InventoryResult` object: - `result` (EResult): Indicates the success or failure of the operation. - `items` (array of ItemDetail): An array containing details of all items found. - `timestamp` (long): The time when the response was originally generated. ### Handler Example ```csharp void HandleInventoryUpdate(InventoryResult response) { // Process response.result, response.items, and response.timestamp } ``` ``` ```APIDOC ## Using ItemData ### Description Updates the inventory data and allows access to specific item details. ### Method `ItemData.Update(HandleInventoryUpdate)` ### Parameters - `HandleInventoryUpdate` (delegate): A callback function that will be invoked with the inventory results. ### Request Example ```csharp ItemData.Update(HandleInventoryUpdate); ``` ### Response The `HandleInventoryUpdate` delegate receives an `InventoryResult` object: - `result` (EResult): Indicates the success or failure of the operation. - `items` (array of ItemDetail): An array containing details of all items found. - `timestamp` (long): The time when the response was originally generated. ### Handler Example ```csharp void HandleInventoryUpdate(InventoryResult response) { // Process response.result, response.items, and response.timestamp } ``` ``` -------------------------------- ### Activate Game Overlay Invite Dialog (Unreal Engine C++) Source: https://kb.heathen.group/steam/features/overlay.md Use these C++ functions in Unreal Engine to activate the invite dialog. One overload accepts an FString ConnectionString, and the other accepts a CSteamID LobbyId. ```cpp // for an FString ConnectionString SteamFriends()->ActivateGameOverlayInviteDialogConnectString(StringCast(*ConnectionString).Get()); // for a CSteamID LobbyId SteamFriends()->ActivateGameOverlayInviteDialog(LobbyId); ``` -------------------------------- ### Get User Session Ticket (C++) Source: https://kb.heathen.group/steam/features/authentication.md Retrieve a user's authentication session ticket in C++. This involves preparing a buffer and using the Steamworks API. ```cpp TArray buffer; buffer.SetNumUninitialized(1024); uint32 BytesWritten = 0; SteamNetworkingIdentity Id {}; Id.m_eType = ESteamNetworkingIdentityType::k_ESteamNetworkingIdentityType_SteamID; Id.SetSteamID(forSteamId); HAuthTicket handle = SteamUser()->GetAuthSessionTicket(buffer.GetData(), 1024, &BytesWritten, &Id); ```