SteamMultiplayerPeer Documentation

repository·main·Indexed 19 days ago

https://github.com/expressobits/steam-multiplayer-peer

A GDExtension for Godot that provides a Steam-based multiplayer peer implementation using Steam Sockets (ISteamNetworkingSockets). Designed as a low-level replacement for ENetMultiplayerPeer, it facilitates peer-to-peer networking but does not currently support channels.

Tokens
564
Snippets
1
Records
5
Agent score
18%

What's inside SteamMultiplayerPeer

  1. Understand the differences between SteamMultiplayerPeer and GodotSteam

    main

    When choosing between SteamMultiplayerPeer and GodotSteam, consider the following architectural differences:

    FeatureSteamMultiplayerPeerGodotSteam SteamMultiplayerPeer
    Lib TypeGDExtension: Easy to add via Asset Library.C++ Module: Requires a precompiled Godot version from GodotSteam or manual compilation.
    Steam ConnectionSteam Sockets (ISteamNetworkingSockets): Low-level connection management, similar to ENet.Steam Messages (ISteamNetworkingMessages): Connection is managed by the lobby; does not use a persistent connection concept.

    Key Takeaway: SteamMultiplayerPeer is designed to be a drop-in replacement for ENetMultiplayerPeer by using Steam's low-level socket system.

  2. Install SteamMultiplayerPeer

    main

    To use SteamMultiplayerPeer in your Godot project, you can install it via the Godot Asset Library or build it from source.

    Installation Options

    • Godot Asset Library: Search for SteamMultiplayerPeer in the Godot Asset Library.
    • Manual/Git: Use the addon branch for compiled libraries or the module branch if you wish to add it as a git submodule.
    • Build from Source: Detailed instructions for building the plugin are available in the project Wiki.
    WARNING

    Development on this plugin has been paused. The author recommends using GodotSteam if possible.

  3. Handle connection events using network_connection_status_changed

    main
    When working with Steamworks, do not rely on ENet pool events to detect client connections. While ENet examples might use pool events, Steamworks utilizes the network_connection_status_changed callback to signal connection changes. Ensure your implementation listens to this callback to correctly manage client connection states.
  4. Use ENet unique IDs instead of Steam IDs for identification

    main

    When mapping or identifying clients, do not use steam_id directly for unique identification. Steam IDs are 64-bit, whereas the return value from certain operations may be 32-bit, leading to mismatches or data loss. Instead, use the unique ID provided by ENet via get_unique_id to ensure correct mapping between unique IDs and Steam IDs.

    enet get_unique_id