# Multiplayer Plan: 2–10 Players, FFA / Team / Multi-Team
## Overview
The existing 1v1 system handles all the hard parts: combat resolution, ability triggers, SP/ST economy, channeling, movement, LoS, aura propagation, and win detection. Multiplayer is primarily an extension of **player-slot management**, **team affiliation**, and **board geometry** — the core rules don't change.
---
## 1. Game Modes
| Mode | Description | Example |
|---|---|---|
| **FFA** (Free-for-All) | Every player is their own team. Last ArchSpirit standing wins. | 4-player FFA |
| **N vs N** | Two teams of equal size. First team to eliminate all opposing ArchSpirits wins. | 3v3, 5v5 |
| **Multi-Team** | Three or more teams of equal size. Last team standing wins. | 2v2v2, 3v3v3, 2v2v2v2 |
| **Asymmetric***(stretch goal)* | Teams of unequal size with handicap modifiers. | 1v2, 1v3 |
### Turn Order
Round-robin across all players in seat order (seat 0 → seat 1 → … → seat N-1 → back to 0).
Within a team, each player takes their own individual turn — teammates do not share a turn. This keeps the core turn loop unchanged and preserves all existing trigger semantics (`IsOwnTurn`, `UntilEndOfTurn`, etc.).
### Win Conditions
- **FFA**: A player is eliminated when their ArchSpirit is destroyed. The last player with a living ArchSpirit wins.
- **Team modes**: A team is eliminated when every member's ArchSpirit has been destroyed. The last surviving team wins.
- Eliminated players continue to spectate but their units stay removed (no "ghost" turns — eliminated players are skipped in turn order).
---
## 2. Server Architecture
### 2a. `GameConfiguration` — new lobby-time record
The ability `Ownership` values already cover the needed semantics:
-`Owner` / `Ally` = same team (update `Own()` to compare `TeamIndex` instead of `AccountId`)
-`Enemy` = any unit on a different team
-`Any`, `ExactSelf`, `Random` = unchanged
No new ownership values needed for team play.
---
## 3. Board Geometry System
### 3a. Design principle
The board is currently a rectangle described by `(rows, cols)`. Extend to a **tile mask** model: a board is a set of `Coord` positions that are valid, plus per-player **starting zones** (a sub-set of tiles designated as the home area for each player slot).
```csharp
publicsealedclassBoardLayout
{
publicrequiredstringShapeName{get;init;}
publicrequiredHashSet<Coord>ValidTiles{get;init;}
publicrequiredList<HashSet<Coord>>StartingZones{get;init;}// index = SeatIndex
}
```
The existing `Grid` class only needs to know which `Coord` values are navigable — it already operates on individual tile lookups, so making the tile mask sparse is a small change.
### 3b. Shape library — one generator per shape
Each generator takes `(playerCount, sizeHint)` and returns a `BoardLayout`.
#### Rectangle (current — 2 players)
```
rows = sizeHint, cols = sizeHint
Starting zones: top 2 rows for P0, bottom 2 rows for P1
```
#### Cross / Plus (4 players)
```
Three overlapping rectangles forming a plus sign.
Starting zones: each arm tip.
```
```
[P1]
[P3][ ][P2]
[P0]
```
#### Triangular (3 players)
```
Equilateral hexagonal triangle, 3 corners.
Starting zones: corner clusters.
```
#### Hexagonal Ring (6 players)
```
Hexagon of hexagonal tiles; 6 equidistant perimeter clusters as starting zones.
```
#### Decagonal (10 players)
```
Large circular arrangement, ~10 radial segments.
Starting zones: one segment per player, evenly distributed around perimeter.
```
#### Radial Star (5, 8 players)
```
Spokes radiating from a shared central arena.
Each player controls one spoke; central tiles are neutral/contested.
The host can override this selection in the lobby.
### 3d. Starting-zone enforcement
When a player channels a Spirit onto the battlefield, valid placement tiles are restricted to that player's starting zone (same as current 1v1 behavior, but the zone is derived from `BoardLayout.StartingZones[SeatIndex]` instead of a hardcoded row range).
---
## 4. Lobby & Matchmaking Changes
### 4a. Room creation
Extend `CreateRoomRequest` / `RoomDto`:
```csharp
publicrecordCreateRoomRequest(
stringMode,// "FFA" | "Teams" | "MultiTeam"
intPlayerCount,// 2–10
intTeamCount,// 1 for FFA, 2+ for team modes
stringBoardShape// "" = auto-select by player count
);
```
### 4b. Team assignment in lobby
For team modes, the room UI shows players grouped by team color. The room host can drag players between teams before starting. For FFA, no team UI is shown.
### 4c. Deck selection
Each player selects their own deck (same as now). No shared/team decks in v1.
---
## 5. Client Changes
### 5a. Player info panel
Currently two side panels (my stats / opponent stats). Replace with a **player ring** that dynamically generates one entry per player, grouped by team color.
```
[P0 - Blue | SP:3 ST:2 | HP:■■■□] [P1 - Blue | SP:2 ST:1 | HP:■■□□]
vs
[P2 - Red | SP:4 ST:3 | HP:■■■■] [P3 - Red | SP:1 ST:2 | HP:■■■□]
```
For FFA, each player's color is unique. For team modes, team members share a color.
### 5b. Turn indicator
The current "your turn / opponent's turn" banner extends to show the active seat's player name and team color.
### 5c. Camera / map view
- The camera must center and zoom to fit whatever board shape is in use
- For non-rectangular boards, the tile placer should mask the valid tile set
- Fog of war remains per-player (each player only sees tiles in their own LoS/range)
### 5d. Targeting highlights
Team-aware: ally units highlighted in blue, enemy units in red, self in white — consistent with `TeamIndex` comparisons.
### 5e. Turn-order display
A compact strip at the top of the screen shows all players in seat order with a pointer to the current active player (inspired by board game UX). Eliminated players are greyed out.
| `SOR.Content/Lobby/` | Room creation with mode/team config |
| `Client/scenes/game/game_screen.gd` | Dynamic player panel, camera fit, turn strip |
| `Client/scenes/free_play/lobby_room_screen.gd` | Team assignment UI, seat slots |
| `Client/autoloads/GameProtocol.gd` | New events: `player_eliminated`, `team_eliminated`, `turn_changed` |
---
## Notes
- **Rules don't change.** Combat, abilities, SP/ST, channeling, LoS — all preserved exactly as-is.
- **The tile coordinate system stays.** `Coord(row, col)` continues to work; non-rectangular boards simply have sparse valid-tile sets.
- **Backward compatibility.** Existing 1v1 games just use two `PlayerSlot` entries with different `TeamIndex` values; no migration of saved games needed.
- **Board shapes are data.** A generator function produces a `BoardLayout` record from `(playerCount, sizeHint)` — no hardcoded map files.
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.