Convert Figma logo to code with AI

rlabrecque logoSteamworks.NET

Steamworks wrapper for Unity / C#

2,741
362
2,741
118

Top Related Projects

Another fucking c# Steamworks implementation

An open-source and fully functional Steamworks SDK / API module and plug-in for the Godot Game Engine.

Quick Overview

Steamworks.NET is a C# wrapper for Valve's Steamworks API, enabling game developers to integrate Steam features into their Unity games. It provides a complete wrapper for the Steamworks API, allowing developers to access Steam's functionality directly from C# code.

Pros

  • Seamless integration with Unity game engine
  • Provides access to a wide range of Steam features (achievements, leaderboards, matchmaking, etc.)
  • Regularly updated to keep up with Steamworks API changes
  • Well-documented with extensive examples and community support

Cons

  • Limited to Steam platform, not suitable for multi-platform games without additional work
  • Requires Steam client to be installed and running for full functionality
  • Learning curve for developers unfamiliar with Steam's ecosystem
  • Potential performance overhead compared to direct C++ implementation

Code Examples

  1. Initializing Steamworks:
using Steamworks;

public class SteamManager : MonoBehaviour
{
    private void Awake()
    {
        if (!SteamManager.Initialized)
        {
            try
            {
                SteamClient.Init(480); // Replace with your game's App ID
                Debug.Log("Steam initialized successfully");
            }
            catch (System.Exception e)
            {
                Debug.LogError("Steam initialization failed: " + e.Message);
            }
        }
    }
}
  1. Unlocking an achievement:
public void UnlockAchievement(string achievementID)
{
    if (SteamManager.Initialized)
    {
        SteamUserStats.SetAchievement(achievementID);
        SteamUserStats.StoreStats();
        Debug.Log("Achievement " + achievementID + " unlocked");
    }
}
  1. Retrieving player's Steam name:
public string GetPlayerName()
{
    if (SteamManager.Initialized)
    {
        return SteamFriends.GetPersonaName();
    }
    return "Unknown Player";
}

Getting Started

  1. Install Steamworks.NET via Unity Package Manager or download from GitHub.
  2. Add the following code to initialize Steam in your game:
using Steamworks;

public class SteamInitializer : MonoBehaviour
{
    private void Awake()
    {
        try
        {
            SteamClient.Init(YOUR_APP_ID);
            Debug.Log("Steam initialized successfully");
        }
        catch (System.Exception e)
        {
            Debug.LogError("Steam initialization failed: " + e.Message);
        }
    }

    private void OnApplicationQuit()
    {
        SteamClient.Shutdown();
    }
}
  1. Attach this script to a GameObject in your initial scene.
  2. Replace YOUR_APP_ID with your game's actual Steam App ID.
  3. Start using Steamworks.NET features in your game!

Competitor Comparisons

Another fucking c# Steamworks implementation

Pros of Facepunch.Steamworks

  • More actively maintained with frequent updates
  • Cleaner, more modern C# API design
  • Better performance due to optimized memory management

Cons of Facepunch.Steamworks

  • Less documentation and community support
  • Potentially less stable due to rapid development

Code Comparison

Steamworks.NET:

SteamAPI.Init();
var appId = SteamUtils.GetAppID();
SteamFriends.SetRichPresence("status", "In Game");

Facepunch.Steamworks:

SteamClient.Init(480);
var appId = SteamClient.AppId;
SteamFriends.SetRichPresence("status", "In Game");

Both libraries provide similar functionality, but Facepunch.Steamworks offers a more streamlined API. The initialization process is simpler, and accessing properties like AppId is more straightforward. However, Steamworks.NET's approach may be more familiar to developers accustomed to the original Steamworks API.

Facepunch.Steamworks generally requires less boilerplate code and provides a more idiomatic C# experience. It also includes some additional features and optimizations not present in Steamworks.NET. However, Steamworks.NET has been around longer and may have better compatibility with older Unity versions and projects.

Ultimately, the choice between the two libraries depends on specific project requirements, desired API style, and the need for cutting-edge features versus stability and extensive documentation.

An open-source and fully functional Steamworks SDK / API module and plug-in for the Godot Game Engine.

Pros of GodotSteam

  • Specifically designed for Godot engine, offering seamless integration
  • Supports multiple platforms including Windows, macOS, and Linux
  • Regular updates and active community support

Cons of GodotSteam

  • Limited to Godot engine, not suitable for other game development frameworks
  • May have a steeper learning curve for developers not familiar with Godot

Code Comparison

GodotSteam:

func _ready():
    Steam.steamInit()
    Steam.connect("leaderboard_scores_downloaded", self, "_on_leaderboard_scores_downloaded")
    Steam.downloadLeaderboardEntries(100, Steam.LEADERBOARD_DATA_REQUEST_GLOBAL, 1, 10)

Steamworks.NET:

void Start() {
    if (SteamManager.Initialized) {
        SteamLeaderboard_t leaderboard = SteamUserStats.FindLeaderboard("MyLeaderboard");
        SteamUserStats.DownloadLeaderboardEntries(leaderboard, ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal, 1, 10, new CallResult<LeaderboardScoresDownloaded_t>());
    }
}

Both libraries provide similar functionality for Steam integration, but GodotSteam is tailored for Godot engine, while Steamworks.NET offers more flexibility for various C# game development environments. The choice between them largely depends on the game engine and development ecosystem being used.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Steamworks.NET

Steamworks.NET is a C# Wrapper for Valve's Steamworks API, it can be used either with Unity or your C# based Application.

Steamworks.NET was designed to be as close as possible to the original C++ API, as such the documentation provided from Valve largely covers usage of Steamworks.NET. Niceties and C# Idioms can be easily implemented on top of Steamworks.NET.

Steamworks.NET fully supports Windows (32 and 64 bit), OSX, and Linux. Currently building against Steamworks SDK 1.60.

Support via Paypal

Installation

You can find the installation instructions here.

Samples

Check out these sample projects to get started: