feat(gameye): configurable environments, DI config, multi-port, and region routing - #24
Conversation
…n routing
Replaces hardcoded constants with a GameyeAllocatorConfig singleton registered
in ModuleConfig.Setup(), making the allocator configurable without touching
implementation code. Adds automatic region selection from Unity QoS
MatchProperties["Region"] as a priority-1 path above LocationByPool.
Changes:
- GameyeAllocatorConfig: DI-registered config class (ImageName, Environment,
DefaultLocation, GamePort, Version, AdditionalPorts, LocationByPool,
LocationByRegion)
- GameyeEnvironment enum: Sandbox / Production — ApiBaseUrl computed from enum,
no raw URL strings to typo
- Three-tier region resolution: MatchProperties["Region"] → LocationByRegion →
PoolName → LocationByPool → DefaultLocation
- Version field on SessionRequest with NullValueHandling.Ignore (omitted from
JSON when null, preserving "use highest priority tag" default)
- AdditionalPorts: extra ports included in AllocationData as port_{name} entries
- Tests updated to NUnit/Moq style matching repo conventions; 21 Gameye tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
||
| Maps Unity Matchmaker **pool names** to Gameye location IDs, enabling dynamic region selection per match. When the matched pool is found in this dictionary, that location is sent to Gameye instead of `DefaultLocation`. Pools not in the map fall through to `DefaultLocation`. | ||
|
|
||
| Unity Matchmaker uses pools for region routing — create one pool per region in your queue configuration, then mirror that mapping here. |
There was a problem hiding this comment.
| Unity Matchmaker uses pools for region routing — create one pool per region in your queue configuration, then mirror that mapping here. | |
| Unity Matchmaker can be configured to use pools for region routing — create one pool per region in your queue configuration, then mirror that mapping here. |
Using this pool-to-region mapping is a decision made by the game dev to not use QoS. The original statement can be understood as something Unity Matchmaker strictly does, which is not true.
There was a problem hiding this comment.
Good catch — you're right that pool-based routing is a developer decision (an alternative to Unity QoS), not something Matchmaker strictly does. Reworded to "can be configured to use pools for region routing" in 4a05258. Thanks!
Address review feedback from @lucy-yuan: pool-to-region mapping is a developer decision (used instead of Unity QoS), not behavior Matchmaker strictly performs. Reword to 'can be configured to use pools'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Environment defaults to Sandbox, which is easy to leave unset when going live. Rather than silently routing production matchmaking traffic to sandbox infrastructure, the allocator now logs the active environment on every allocation: a WARNING in Sandbox (with a reminder to set Production) and an INFO confirmation in Production. - GameyeAllocator.Allocate: log active environment + ApiBaseUrl - CONFIGURATION.md: callout that Environment defaults to Sandbox and the allocator warns until switched to Production - Tests: assert the Sandbox warning fires and Production logs info with no warning; clear logger invocations per test (shared NUnit fixture) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| config.Dependencies.AddSingleton(new GameyeAllocatorConfig | ||
| { | ||
| // Required — the application image name registered in the Gameye Admin Panel. | ||
| ImageName = "test_nginx", |
There was a problem hiding this comment.
Does this name map to onboarding steps, in other allocators we use "your-image-name" to help make it clear users need to change this.
There was a problem hiding this comment.
Good point, test_nginx reads like a concrete onboarding value. Updated it to your-image-name in 2bcd3c1 so it is clearly a placeholder users need to replace.
FelixWentworth-Unity
left a comment
There was a problem hiding this comment.
Looks good - thanks for making the edits
Description
Upgrades the GameyeAllocator with four improvements that make it production-ready without requiring users to edit implementation code.
Type of Change
Provider Integration
Changes Made
1. DI-based configuration (
GameyeAllocatorConfig)Replaces the hardcoded
constfields with aGameyeAllocatorConfigsingleton registered inModuleConfig.Setup(). Users edit one config block — no hunting forconstlines in the implementation.2. Configurable environments (
GameyeEnvironmentenum)Adds
SandboxandProductionenum values.ApiBaseUrlis computed from the enum so there are no raw URL strings to typo. Defaults toSandbox(safe default for new integrations).3. Automatic region selection (
LocationByRegion+LocationByPool)Three-tier region resolution priority:
MatchProperties["Region"]→LocationByRegion(Unity QoS resolved region — preferred, no per-region pools needed)PoolName→LocationByPool(pool-name mapping for studios using per-region pools without QoS)DefaultLocation(static fallback)Uses
"Region"(capital R) to match the convention established in PR #21 and the empty-string guard from PR #23.4. Version field and additional ports
VersiononSessionRequestwithNullValueHandling.Ignore— omitted from JSON when null, preserving Gameye's "use highest priority tag" defaultAdditionalPortsdictionary — extra ports (e.g. query, RCON) returned inAllocationDataasport_{name}entries alongside the primary portTesting
21 NUnit tests covering: basic allocation, environment URL selection, version field (present/omitted), additional ports, all three region resolution paths (QoS wins over pool, pool wins over default, empty Region string falls back), poll fast-path and API fallback, all Gameye status → PollStatus mappings, error handling.
Security Checklist
GAMEYE_API_TOKEN)Code Provenance
License Agreement
Documentation
Provider Terms Compliance
Community Support Acknowledgment