Skip to content

nalchi-net/Backdash.Gns

Repository files navigation

Backdash.Gns

Backdash.Gns adds GnsSharp extension to Backdash.

With this integration, you can use Backdash with Steam Networking Messages.

State of integration

Currently, only the Steamworks SDK integration is supported.

Open-source standalone GameNetworkingSockets is not supported yet, because of some upstream issues.
See Issue #1 for details.

Nuget package

There are 4 different nuget packages available for different backends & platforms.

dotnet add package Backdash.Gns.Steamworks.Win64 --prerelease    # Steamworks SDK for Windows 64-bit
dotnet add package Backdash.Gns.Steamworks.Win32 --prerelease    # Steamworks SDK for Windows 32-bit
dotnet add package Backdash.Gns.Steamworks.Posix64 --prerelease  # Steamworks SDK for POSIX 64-bit
dotnet add package Backdash.Gns.Steamworks.Posix32 --prerelease  # Steamworks SDK for POSIX 32-bit

Usage

You first need to initialize GnsSharp and call RunCallbacks() periodically in somewhere.
See GnsSharp repo for more info about this.

After that, you can build the GameNetworkingSockets session something like this:

// Port number is used as a "Channel" number for `ISteamNetworkingMessages`.
// The smaller the better, but Backdash doesn't allow port `0`, so we're using `1` here.
int channel = 1;

// Set the peer identity  (assuming we're using Steamworks SDK for this example)
SteamNetworkingIdentity peerIdentity = default;
peerIdentity.ParseString("steamid:76561198951047696");

// one local player + one `SteamEndPoint` remote player
int playerCount = 2;
var players = new NetcodePlayer[playerCount];
players[0] = NetcodePlayer.CreateLocal()
players[1] = NetcodePlayer.CreateRemote(new SteamEndPoint(peerIdentity, channel));

NetcodeSessionBuilder<MyGameInput> builder = RollbackNetcode
    .WithInputType<MyGameInput>()
    .UseGameNetworkingSockets()    // Use GnsSharp integration (extension method)
    .WithPort(channel)             // Set the "Channel" number for `ISteamNetworkingMessages`
    .WithPlayerCount(playerCount)
    .WithPlayers(players)
    .ForRemote();

INetcodeSession<MyGameInput> session = builder.Build();

The rest should be the same as the regular Backdash usage.

License

This integration itself is licensed under the 0BSD, so you can use this freely without including an additional license file.

However, you still need to follow the licenses of the underlying projects:

About

GnsSharp extension to Backdash. (Steam Networking Messages)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages