Skip to content

OAAB-Book/OrleansNet6Presence

Repository files navigation

Orleans Gaming Presence service sample

This sample demonstrates a gaming presence service in which a game server (represented by the LoadGenerator application) sends periodic heartbeats to a cloud service (represented by the PresenceService application) containing the status of a game which it is hosting. Inside the service, a corresponding PresenceGrain is responsible for unpacking the heartbeat message and reflecting the state of the game in the PlayerGrain and GameGrain grains. The effects of this can be seen on a client application (PlayerWatcher), which polls the player for the current game session. Each time a new game session is returned, the client creates a new LoggerGameObserver which subscribes to the game grain so that status updates are pushed to it using the IGameObserver interface.

A visual representation of the above text

Sample prerequisites

This sample is written in C# and targets .NET 6.0. It requires the .NET 6.0 SDK.

Building the sample

To download and run the sample, follow these steps:

  1. Download and unzip the sample.
  2. In Visual Studio (2022 or later):
    1. On the menu bar, choose File > Open > Project/Solution.
    2. Navigate to the folder that holds the unzipped sample code, and open the C# project (.csproj) file.
    3. Choose the F5 key to run with debugging, or Ctrl+F5 keys to run the project without debugging.
  3. From the command line:
    1. Navigate to the folder that holds the unzipped sample code.
    2. At the command line, type dotnet run.

To build and run the sample step-by-step on the command line, use the following commands:

Build the solution using the .NET CLI:

dotnet build

Launch the server process:

dotnet run --project ./src/PresenceService

In a separate terminal window, launch the player watcher:

dotnet run --project ./src/PlayerWatcher

In a separate terminal window, launch the load generator:

dotnet run --project ./src/LoadGenerator

About

Orleans Gaming Presence service sample in .NET 6

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published