Skip to content

A Remote Procedure Call framework for Godot C# using source generators.

License

Notifications You must be signed in to change notification settings

Joy-less/RemSend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b22aed7 · Mar 13, 2025
Jul 29, 2024
Mar 4, 2025
Mar 13, 2025
Mar 13, 2025
Feb 15, 2025
Feb 9, 2025
Jul 28, 2024
Feb 9, 2025
Feb 19, 2025
Feb 9, 2025
Feb 15, 2025
Feb 15, 2025

Repository files navigation

Rem Send

NuGet

A Remote Procedure Call framework for Godot C# using source generators.

Features

  • Call source-generated RPCs with static typing and optimal performance.
  • Request and return values from RPCs.
  • Send variant-incompatible values with MemoryPack.
  • Extra access enum (peer -> authority).
  • Fully compatible with async / Tasks.
  • Created for use in a real MMORPG.

Setup

  1. Install RemSend through NuGet.
  2. Connect RemSend to your MultiplayerApi by using the following code:
RemSendService.Setup((SceneMultiplayer)Multiplayer, GetTree().Root);

Examples

Sending a method call to a remote peer:

[Rem(RemAccess.Any)]
public void SayWords(List<string> Words) {
    foreach (string Word in Words) {
        GD.Print(Word);
    }
}

// Send SayWords to authority
SendSayWords(1, ["cat", "dog"]);
// Broadcast SayWords to all peers
BroadcastSayWords(["cat", "dog"]);

Requesting a result from a peer:

[Rem(RemAccess.PeerToAuthority)]
public int GetNumber() {
    return 5;
}

// Send GetNumber to authority and await result for up to 10 seconds
int Number = await RequestGetNumber(1, TimeSpan.FromSeconds(10));

Getting the remote sender's peer ID:

[Rem(RemAccess.Any)]
public void RemoteHug([Sender] int SenderId) {
    if (SenderId is 1) {
        GD.Print("Thank you authority.");
    }
    else if (SenderId is 0) {
        GD.Print("*depression*");
    }
    else {
        GD.Print("Thank you random peer.");
    }
}

// Send RemoteHug to authority
SendRemoteHug(1);

Notes

  • Since RemSend uses SceneMultiplayer.SendBytes and SceneMultiplayer.PeerPacket, using them with RemSend is not recommended. However, you can still use RPCs.
  • RemSend does not support GDScript or C++. It can only be used with C#. Other languages can use RPCs instead.

Special Thanks

About

A Remote Procedure Call framework for Godot C# using source generators.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages