In it's core SteamNetGodot is the combination of Facepunch.Steamworks and LiteNetLib. A performant, easy to use C# Steam Networking library for the wonderful Godot engine.
It will be regularly updated since it's currently in use on our game Taverna.
- Compressed Steam VoIP (3-5 KB/s)
- Smart matchmaking through Steam Lobbies / internal logic
- RPC system
- Very simple C# code
- Bunch of cool networking code as example (replication, resource management, audio, kick, mute, ban...)
- Open Source
- Godot 4.3
- MIT license
public struct VoicePacket : INetSerializable
{
public uint networkId;
public ulong internalVoiceTick;
public int size;
public ArraySegment<byte> compressedVoiceData;
public ulong fromUser;
public void Deserialize(NetDataReader reader)
{
networkId = reader.GetUInt();
internalVoiceTick = reader.GetULong();
size = reader.GetInt();
compressedVoiceData = reader.GetBytesSegment(size);
fromUser = reader.GetULong();
}
public void Serialize(NetDataWriter writer)
{
writer.Put(networkId);
writer.Put(internalVoiceTick);
writer.Put(size);
writer.PutBytesSegment(compressedVoiceData);
writer.Put(fromUser);
}
}
NetworkManager.Instance.Client_SubscribeRPC<VoicePacket, Connection>(Client_OnVoicePacketReceived, () => this.IsValid() == false);
NetworkManager.Instance.Server_SubscribeRPC<VoicePacket, Connection>(Server_OnVoicePacketReceived, () => this.IsValid() == false);
VoicePacket voicePacket = new VoicePacket();
voicePacket.compressedVoiceData = compressedVoiceData;
voicePacket.size = compressedVoiceData.Count;
voicePacket.internalVoiceTick = internalVoiceTick;
voicePacket.networkId = pawn.networkId;
NetworkManager.Instance.Client.Send<VoicePacket>(voicePacket, SendType.Reliable);
ObjectState player = gameState.Server_CreateObjectStateAndPawn((uint)steamId, ResourceId.PawnPlayer, "", steamId, true);
Friend playerSteam = new Friend(steamId);
await playerSteam.RequestInfoAsync();
player.GetPawn().SetName(playerSteam.Name);
UINotifications.Instance.PushNotification($"Instantiated Pawn for player {playerSteam.Name}");
Great! And I don't like you. Jokes aside, the base code is divided from the gameplay solution. For sake of easier maintainability it was all put inside one project.
Get BaseClient, BaseServer, Processor and you are good to move to your solution.
You still need to import Facepunch.Steamworks and LiteNetLib as they are in the backbone of the library.
Aimed to get zero garbage on receive / read . If you find some bad stuff let us know.
VOIP bandwidth is between 3-5KB/s.
Transform replication has little optimization. When moving between 15-20 KB/s 60h tick rate. I would recommend to strip it down to make it usable. I will remove this little paragr as soon as I commit the improvements.
Make sure to add steam_api64.dll to your exported build
Yes but not no prediction. It will be added in the future.
No prediction.
A string that represent a resource. It's a convenient way to do local instantiation and replication.
We added a little addon to easily handle them in the inspector
#if TOOLS
[ResourceIdDropdown]
#endif
[Export]
public string resourceId;
You still need to add them manually in ResourceId.cs
https://partner.steamgames.com/doc/features/enhancedrichpresence