Commit Graph
10 Commits
Author SHA1 Message Date
2cfa60c7dd Add hex grid support (sides 3–10) for boards, pathfinding, LOS, and client rendering
- New HexGrid.cs: axial coord helpers, BFS neighbors, cube-lerp LOS, jump-range
- Board: HexSides property, GetNeighbors() dispatches hex/square, IsInBounds() hex-aware
- BoardShapeGenerator: MakeHexagon() with edge-based starting zones (2–6 players);
  FromTemplate() now carries HexSides through to the Board
- Pathfinding: Walk/Flight BFS uses board.GetNeighbors() (hex+square unified)
- LineOfSight: delegates to HexGrid.HasLos when hexSides > 0
- GameRules/GameRuleSet/BoardTemplate/BoardTemplateSnapshot: GridType + HexSides fields
- GameMessages BoardDto: GridType + HexSides sent to client
- GameEngine: PlaceArchSpirit range uses HexGrid.Distance on hex boards;
  Teleport LOS passes board.HexSides; ToBoardDto emits GridType/HexSides
- EF migration 20260401000000_AddHexGridSupport: grid_type + hex_sides columns on
  game_rule_sets and board_templates; applied to pg-forge-01
- Client game_screen.gd: hex coord→world (pointy-top flat layout), CylinderMesh
  tiles (radial_segments=6), _board_distance cube metric, _bfs_reachable 6-dir,
  _client_has_los cube-lerp, highlight mesh for hex tiles; reads gridType/hexSides
  from BoardDto

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>
2026-04-01 16:44:17 -04:00
bd59904ce2 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>
2026-03-28 15:18:53 -04:00
4138ba39e7 Add empty-tile support to board template builder
- SnapshotTile: add IsAbsent flag (JSON: "absent")
- BoardShapeGenerator.FromTemplate(): absent tiles are removed from
  the tiles dict instead of being filled with Void+Void, producing
  sparse board layouts with genuine missing cells
- Builder: Empty swatch in paint palette marks cells as absent
  (striped crosshatch visual); absent cells are excluded from zone
  assignment; PureVoid paint clears absent state back to valid void;
  ApplyModal() also clears IsAbsent; SerializeTiles() includes absent
  entries so they round-trip correctly through save/load

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>
2026-03-27 22:15:31 -04:00
1368083405 Implement phase-2 board template engine integration
- Add BoardTemplateJson (nullable string) to GameRules so admin-defined
  board layouts are snapshotted at session creation; in-flight games are
  unaffected by subsequent template edits.
- Introduce BoardTemplateSnapshot + SnapshotTile types in SOR.Game.Grid
  (integer-enum serialisation matching the admin builder).
- BoardShapeGenerator.FromTemplate / FromTemplateJson: build a Board from
  a snapshot, respecting AffinityOverrideable + StartingRandomTilePct.
- GameEngine.Initialize: use FromTemplateJson when BoardTemplateJson is set,
  falling back to algorithmic Generate.
- GameLobbyReadyHandler: load BoardTemplateIdOverride template from DB and
  embed as BoardTemplateJson in the rule snapshot at lobby start.
- MatchmakerService: load BoardTemplateId template from DB and embed via
  JsonElement in the ranked-rule snapshot at match creation.

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>
2026-03-27 21:03:05 -04:00
Shard 4737d337fa Fix triangular board compile error (nested Math.Max) 2026-03-26 23:08:45 +00:00
Shard 532ea81698 Rework triangular board to equidistant corner starts 2026-03-26 23:05:37 +00:00
Shard c8feeb9d5b Fix board shape resolution and implement true triangular footprint 2026-03-26 22:47:10 +00:00
7fd5beb172 Fix 2-player placement zone and game.over null crash
BoardShapeGenerator: 2-player rectangle now assigns one row per seat
(row 0 for seat 0, top row for seat 1), restoring the original 1v1
behaviour.  3-4 player lobbies keep the two-row zones for extra
placement room.

Game.gd game.over: server sends playerOutcomes:null for 2-player games.
d.get(key, default) returns null when the key exists with value null,
so 'null as Array' crashed.  Use 'is Array' guard to safely fall back
to an empty array when the field is absent or null.

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>
2026-03-26 09:22:14 -04:00
356e1a50e3 Phase 3 & 4: Team colors, player_eliminated push, board shapes, lobby team UI
Phase 3 – Team modes:
- GameState: TeamColors dictionary (int → hex color string) populated from palette
- GameMessages: PlayerEliminatedPush, PlayerOutcomeDto, extended GameOverPush
- GameHandlerBase: FinalizeMultiPlayerGameAsync (pairwise ELO), BroadcastPlayerEliminatedAsync, GetAllPlayerIds for N-player push
- GameAttackHandler: snapshot pre-attack elimination state; use FinalizeMultiPlayerGameAsync; push PlayerEliminatedPush for mid-game knockouts
- game_screen.gd: turn order strip chips carry team-color left border from state.teamColors
- lobby_room_screen.gd: _team_label() helper; team badges on host/guest/additional slots

Phase 4 – Board shape library:
- BoardShapeGenerator: AutoShape() picks shape by player count; adds Triangular (3p), RadialStar (5p, 5-arm star), HexRing (6p, hex perimeter zones); CoordsInRect helper
- GameLobbyReadyHandler: auto-selects board shape at game start; passes BoardShape+PlayerCount into rules snapshot

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>
2026-03-26 05:50:55 -04:00
f700fd5de6 Implement multiplayer extension: 2-10 players FFA/Team/Multi-Team
Core engine:
- Add SeatIndex, TeamIndex, IsEliminated to PlayerState
- Add SeatOrder, GameMode to GameState with helpers: ActiveSeats(),
  GetNextActiveSeat(), GetEnemyIds(), AreAllies()
- Add StartingZones to Board for per-seat placement validation
- Add BoardShape, PlayerCount to GameRules
- New BoardShapeGenerator: Rectangle (up to 4 seats) + Cross shapes
- N-player Initialize() overload; old 2-player overload delegates to it
- EndTurn uses GetNextActiveSeat() instead of hardcoded GetOpponentId()
- Attack finds target across all enemy players; EliminatePlayer() helper
  allows multi-player elimination without immediate game over
- PlaceArchSpirit validates via StartingZones (legacy row fallback preserved)
- AbilitySystem.Own() uses AreAllies() for team-aware ownership checks

Database:
- GameSession: +player_count, +game_mode, +additional_players_json
- CustomLobby: +game_mode, +team_count, +additional_players_json
- EF migration: AddMultiplayerSlots (applied)

Handlers:
- GameCreateCustomLobbyHandler: honours MaxPlayers/GameMode/TeamCount from request
- GameJoinCustomLobbyHandler: multi-slot join up to MaxPlayers
- GameLobbyReadyHandler: N-player all-ready check; seats/team assignment by mode
- GameReadyHandler: builds N-player list from AdditionalPlayersJson
- GameHandlerBase.LoadActiveSessionAsync: recognises additional players

Client:
- Game.gd: get_opponents() returns all non-local players;
  get_opponent() kept as backward-compat alias returning first opponent

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>
2026-03-25 23:57:36 -04:00