feat(multiplayer): persist ranked arena allocations

This commit is contained in:
Josh Creek
2026-09-01 21:04:55 +01:00
parent 5630c5c8dc
commit 84372204fd
22 changed files with 100 additions and 33 deletions
+2 -1
View File
@@ -31,6 +31,7 @@ type AllocationRequest struct {
Region string
Build string
Protocol int
ArenaPath string
Transport string
}
@@ -142,5 +143,5 @@ func validateAllocationRequest(request AllocationRequest) error {
}
func allocationDigest(request AllocationRequest) [32]byte {
return sha256.Sum256([]byte(fmt.Sprintf("%s\x00%s\x00%s\x00%s\x00%d\x00%s", request.AllocationID, request.MatchID, request.Region, request.Build, request.Protocol, request.Transport)))
return sha256.Sum256([]byte(fmt.Sprintf("%s\x00%s\x00%s\x00%s\x00%d\x00%s\x00%s", request.AllocationID, request.MatchID, request.Region, request.Build, request.Protocol, request.Transport, request.ArenaPath)))
}
+3
View File
@@ -74,6 +74,9 @@ func PrepareProposal(id string, playlist Playlist, formation MatchFormation, ran
}
proposal.Region = formation.Selection.Region
proposal.Protocol = formation.Selection.Players[0].ProtocolVersion
if playlist == Ranked {
proposal.ArenaPath = arena.Path
}
for _, player := range formation.Selection.Players {
if player.ProtocolVersion != proposal.Protocol {
return PreparedProposal{}, fmt.Errorf("formed match has mixed protocols")
+1
View File
@@ -43,6 +43,7 @@ type Proposal struct {
Playlist Playlist
Region string
Protocol int
ArenaPath string
Participants []ProposalParticipant
State State
Revision uint64
+5 -4
View File
@@ -11,7 +11,8 @@ type RankedParticipant struct {
}
type RankedArena struct {
ID string
ID string
Path string
}
// rankedArenas is the server-owned eligibility registry for launch ranked
@@ -19,9 +20,9 @@ type RankedArena struct {
// project, but deliberately excludes every elevated-goal variant until a
// policy trained for that geometry is promoted.
var rankedArenas = map[string]RankedArena{
"arena_01": {ID: "arena_01"},
"arena_02": {ID: "arena_02"},
"arena_03": {ID: "arena_03"},
"arena_01": {ID: "arena_01", Path: "res://scenes/arena_01.tscn"},
"arena_02": {ID: "arena_02", Path: "res://scenes/arena_02.tscn"},
"arena_03": {ID: "arena_03", Path: "res://scenes/arena_03.tscn"},
}
// DefaultRankedArena supplies a safe server-owned eligibility decision while