dreamteam-hq/brigid/dotnet-gameserver-hosting
Claude Code and agent skill by dreamteam-hq/brigid
- community
Checking that the SKILL.md file is still in the repository.
.NET Generic Host patterns for headless game servers — BackgroundService tick loops, DI patterns, graceful shutdown, WebSocket hosting
Install
npx vskill@latest install dreamteam-hq/brigid/dotnet-gameserver-hostingSKILL.md
The same SKILL.md was published earlier as dreamteam-hq/brigid/dotnet-gameserver-hosting.
.NET Game Server Hosting
Domain knowledge for .NET Generic Host patterns specific to headless game servers. NO MCP servers.
1. Generic Host for Games
Use WebApplication.CreateBuilder() + AddHostedService<T>() for background game logic. WebSocket endpoint handles client connections. Wire everything through DI.
This project's pattern: MapHub as singleton (owns all map state), SocketHandler as singleton (manages WebSocket connections), BackgroundService subclasses drive server-controlled entities (patrols, spawns, world ticks).
2. BackgroundService Tick Loop
ExecuteAsync with while (!stoppingToken.IsCancellationRequested). Use Task.Delay for tick cadence. Never spin-wait. Pass CancellationToken on every await. For physics-rate ticks: Stopwatch + sleep to maintain consistent tick rate regardless of work duration.
3. DI Registration Patterns
AddSingletonfor game state (MapHub,ConnectionService) — one instance, shared across all servicesAddHostedServicefor background loops — started/stopped by the host- Inject via constructor
This project: MapHub registered as both concrete type and IMapHub interface for shared instance.
4. WebSocket Hosting
app.UseWebSockets() + app.Map("/ws", handler.ProcessSocket). SocketHandler manages per-connection lifecycle. Each connection gets a ConnectedUser with an Outgoing channel. Use BoundedChannel with FullMode.DropOldest to prevent slow clients from blocking the server.
Two tasks per connection: one reads from WebSocket, one writes from the channel. When either completes, the connection tears down.
5. Graceful Shutdown
ApplicationStopping token triggers shutdown sequence. BackgroundService.StopAsync called by the host. Drain player connections: send disconnect message, wait for outgoing channels to flush, close WebSockets with CloseAsync, timeout after 5s if clients don't disconnect cleanly.
6. Health Checks
app.MapHealthChecks("/health") for container orchestration. Checks: can accept WebSocket connections, game loop is ticking (last tick within tolerance), memory pressure acceptable. Readiness probe: accepting new players? Liveness probe: process responsive?
7. Configuration
appsettings.json for tuning (tick rate, max players, patrol parameters). IOptions<T> pattern. Environment variable overrides for containers. This project today: all consts in code — move to config when there is more than one tunable per concern.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dotnet-gameserver-hosting/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dreamteam-hq/brigid/dotnet-gameserver-hosting)