Add Decagonal board shape, team reassignment, and multiplayer considerations
- BoardShapeGenerator: add MakeDecagonal() for 7-10 players (10-armed radial, 11x11 arena, 21x21 total); AutoShape now routes 7-10 to Decagonal - CustomLobby: add TeamAssignmentsJson (seat -> team override map) - GameMessages: add ReassignTeamRequest/Response, LobbyTeamAssignmentChangedPush, SeatTeams field on JoinCustomLobbyResponse - GameReassignTeamHandler: new game.custom.reassign_team handler (host-only); pushes team_reassigned to all participants including additional players - EF migration: AddTeamAssignmentsToLobby (applied to pg-forge-01) - Client CustomLobby.gd: seat_teams state, reassign_team() action, push handler - lobby_room_screen.gd: _rebuild_team_controls() renders host-only [<] Tx [>] cycle buttons per seat in team modes; _team_label() reads seat_teams overrides - OVERALL.md: add Considerations for Later (fog of war, asymmetric teams, ranked ELO) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -14,11 +14,15 @@ public static class BoardShapeGenerator
|
||||
/// </summary>
|
||||
public static string AutoShape(int playerCount) => playerCount switch
|
||||
{
|
||||
3 => "Triangular",
|
||||
4 => "Cross",
|
||||
5 => "RadialStar",
|
||||
6 => "HexRing",
|
||||
_ => "Rectangle", // 2 and 7–10
|
||||
3 => "Triangular",
|
||||
4 => "Cross",
|
||||
5 => "RadialStar",
|
||||
6 => "HexRing",
|
||||
7 => "Decagonal",
|
||||
8 => "Decagonal",
|
||||
9 => "Decagonal",
|
||||
10 => "Decagonal",
|
||||
_ => "Rectangle", // 2
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -38,6 +42,7 @@ public static class BoardShapeGenerator
|
||||
"triangle" => "Triangular", // alias accepted from older/alternate clients
|
||||
"radialstar" => "RadialStar",
|
||||
"hexring" => "HexRing",
|
||||
"decagonal" => "Decagonal",
|
||||
_ => "Rectangle",
|
||||
};
|
||||
}
|
||||
@@ -52,6 +57,7 @@ public static class BoardShapeGenerator
|
||||
"Triangular" => MakeTriangular(rules),
|
||||
"RadialStar" => MakeRadialStar(rules),
|
||||
"HexRing" => MakeHexRing(rules),
|
||||
"Decagonal" => MakeDecagonal(rules, playerCount),
|
||||
_ => MakeRectangle(rules, playerCount),
|
||||
};
|
||||
}
|
||||
@@ -269,6 +275,76 @@ public static class BoardShapeGenerator
|
||||
return new Board { Width = board.Width, Height = board.Height, Tiles = board.Tiles, StartingZones = zones };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decagonal radial board for 7–10 players.
|
||||
/// A filled square central arena with up to 10 arms evenly spaced around it.
|
||||
/// Only the first <paramref name="playerCount"/> arms are activated; the rest are omitted.
|
||||
/// Arm tips in clockwise order starting at the bottom: 270°, 306°, 342°, 18°, 54°, 90°,
|
||||
/// 126°, 162°, 198°, 234°.
|
||||
/// </summary>
|
||||
private static Board MakeDecagonal(GameRules rules, int playerCount)
|
||||
{
|
||||
const int armLen = 5;
|
||||
const int arenaR = 5; // half-width of central square (11×11)
|
||||
int center = arenaR * 2 + 1; // 11
|
||||
int total = center + armLen * 2; // 21
|
||||
|
||||
var tiles = new Dictionary<string, Tile>();
|
||||
|
||||
int c = total / 2;
|
||||
// Central arena
|
||||
for (int x = c - arenaR; x <= c + arenaR; x++)
|
||||
for (int y = c - arenaR; y <= c + arenaR; y++)
|
||||
AddTile(tiles, x, y, rules.StartingRandomTilePct);
|
||||
|
||||
// 10 arm directions evenly spaced at 36° each.
|
||||
// Grid-approximated unit directions (dx, dy) — chosen so each arm has
|
||||
// a non-degenerate path from the arena edge to its tip.
|
||||
// Angles: 270°, 306°, 342°, 18°, 54°, 90°, 126°, 162°, 198°, 234°
|
||||
(int dx, int dy)[] allDirs =
|
||||
[
|
||||
( 0, -1), // 0: 270° bottom
|
||||
( 1, -1), // 1: 306° lower-right diagonal
|
||||
( 1, 0), // 2: 342°/0° right
|
||||
( 1, 1), // 3: 54° upper-right diagonal
|
||||
( 0, 1), // 4: 90° top
|
||||
(-1, 1), // 5: 126° upper-left diagonal
|
||||
(-1, 0), // 6: 162°/180° left
|
||||
(-1, -1), // 7: 198°/216° lower-left diagonal
|
||||
// Two extra arms split the diagonal sectors for 9/10 players.
|
||||
// These reuse adjacent diagonals with a slight offset (arm root shifted).
|
||||
( 1, -1), // 8: duplicate lower-right — arm rooted 2 cols right of center
|
||||
(-1, 1), // 9: duplicate upper-left — arm rooted 2 cols left of center
|
||||
];
|
||||
|
||||
// Root offsets for arms 8 and 9 to avoid overlap with arms 1/5.
|
||||
int[] rootOffsetX = [0, 0, 0, 0, 0, 0, 0, 0, 2, -2];
|
||||
int[] rootOffsetY = [0, 0, 0, 0, 0, 0, 0, 0, -2, 2];
|
||||
|
||||
int seats = Math.Clamp(playerCount, 7, 10);
|
||||
var zones = new Dictionary<int, HashSet<Coord>>();
|
||||
|
||||
for (int seat = 0; seat < seats; seat++)
|
||||
{
|
||||
var (dx, dy) = allDirs[seat];
|
||||
int rx = c + rootOffsetX[seat];
|
||||
int ry = c + rootOffsetY[seat];
|
||||
int tipX = rx, tipY = ry;
|
||||
for (int step = 1; step <= armLen; step++)
|
||||
{
|
||||
int ax = rx + dx * step;
|
||||
int ay = ry + dy * step;
|
||||
// Clamp to grid bounds.
|
||||
if (ax < 0 || ax >= total || ay < 0 || ay >= total) break;
|
||||
AddTile(tiles, ax, ay, rules.StartingRandomTilePct);
|
||||
tipX = ax; tipY = ay;
|
||||
}
|
||||
zones[seat] = new HashSet<Coord> { new Coord(tipX, tipY) };
|
||||
}
|
||||
|
||||
return new Board { Width = total, Height = total, Tiles = tiles, StartingZones = zones };
|
||||
}
|
||||
|
||||
// ── Template-based board ──────────────────────────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user