Rudder

Rudder SDK packages

Rudder.Server (1.0.0)

Published 2026-11-01 19:28:23 +01:00 by edmand46

Installation

dotnet nuget add source --name rudder --username your_username --password your_token https://hub.rudder.build/api/packages/rudder/nuget/index.json
dotnet add package --source rudder --version 1.0.0 Rudder.Server

About this package

The game server of Rudder for .NET: typed calls of the modules of a project for a named player, its profile, its ban and the environment of the key.

Rudder.Server

The game server of Rudder for .NET. It calls the functions of the modules of a project for a player the game server names, and it updates the profile of a player, its ban and the environment of the key. It targets .NET Standard 2.1 and has no dependencies.

Install

dotnet add package Rudder.Server --source https://hub.rudder.build/api/packages/rudder/nuget --api-key <token>

The source and the token are those of the Rudder Gitea (Settings → Applications).

Generate the client

In the repository of the game server, where rudder project use chose the project:

rudder server generate --lang csharp --output src/RudderServer.g.cs --namespace Game \
  [--game-address https://api.rudder.build] [--environment staging|prod]

The client follows the newest release of the environment, staging by default: a class per module with a method per function, the functions marked server included, and the types of their arguments and results. Every method names the player first. Generate it again when a release changes the functions or their types.

Use

using Game;
using RudderServer;

var rudder = new RudderServer(new ServerOptions
{
    ServerKey = Environment.GetEnvironmentVariable("RUDDER_SERVER_KEY")!,
});

var environment = await rudder.Server.Environment();
var purchase = await rudder.Shop.Buy(playerId, new Shop.BuyArguments { Offer = "pumpkin-pack" });

await rudder.Server.SetPlayerProfile(playerId, new Profile { Nickname = "Ada", Avatar = "https://example.com/ada.png" });
await rudder.Server.BanPlayer(playerId, new Ban { Until = DateTimeOffset.Parse("2026-12-01T00:00:00Z"), Reason = "cheating" });
await rudder.Server.UnbanPlayer(playerId);

ServerOptions takes the ServerKey of the environment, Address (the one given to --game-address when missing), Attempts and Transport. The generated RudderServer holds the core Server and a module each: the profile, the ban and the environment live on rudder.Server, the functions of a module on rudder.<Module>.

  • Environment. rudder.Server.Environment() answers staging or prod, the environment of the server key. The header of the generated file names the environment it was generated from.
  • Calls. A mutation sends an Idempotency-Key, generated for each call unless new MutationOptions { IdempotencyKey = ... } is passed. A banned player is refused to the game client only.
  • Errors. A refused call throws RudderException with Code, Message and Status.
  • Retries. A request that got no answer or the answer try_again is sent again after the Retry-After it gave or a short backoff, at most Attempts times (5), with the same idempotency key. 429 is not retried.
  • Cancel. Every method takes a CancellationToken.
Details
NuGet
2026-11-01 19:28:23 +01:00
1
Rudder
17 KiB
Assets (2)
Versions (1) View all
1.0.0 2026-11-01