SharpGameService.Core
1.1.0
dotnet add package SharpGameService.Core --version 1.1.0
NuGet\Install-Package SharpGameService.Core -Version 1.1.0
<PackageReference Include="SharpGameService.Core" Version="1.1.0" />
<PackageVersion Include="SharpGameService.Core" Version="1.1.0" />
<PackageReference Include="SharpGameService.Core" />
paket add SharpGameService.Core --version 1.1.0
#r "nuget: SharpGameService.Core, 1.1.0"
#addin nuget:?package=SharpGameService.Core&version=1.1.0
#tool nuget:?package=SharpGameService.Core&version=1.1.0
SharpGameService Core
This contains the core library for SharpGameService, a C# library made to help you create game servers, include the hosting the game logic itself.
Glossary
House
- A house represents a collection of rooms, which are the games that are being played. Each house can have multiple rooms, and each room can have multiple players.Room
- A room represents a single game instance. Each room can have multiple players, and each player will send and receive messages to and from the room. A room is where the game logic will happen.
Usage
To use the library you will need to implement the following interfaces to handle your own game and service logic:
BaseRoom
- Inheriting from this will allow you to have the connection and messaging in SharpGameService.Core along with implementing your own server side game logic.- A Hosted Service, you will need to inherit from something like BackgroundService or IHostedService and this will be the core to firing up the server, handling the auto processing and shutting it down.
Along with the implementation of the above, in your host setup and build you will need to add the following:
builder.Services.AddSharpGameService<YourHostedService, YourRoom>();
- This will add the hosted service and the room to the DI container with default options (you are able to setup options using a lamda function).
and after builder.Build().
app.UseSharpGameService(webSocketConfig);
- This will add the middleware to the pipeline, this is required for the WebSocket connections to be handled.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.AspNetCore.Routing (>= 2.3.0)
- System.Net.WebSockets (>= 4.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharpGameService.Core:
Package | Downloads |
---|---|
SharpGameService.Extensions
The extensions to the SharpGameService |
GitHub repositories
This package is not used by any popular GitHub repositories.