Skip to content

refactor: decouple game participants from human players - #85

Merged
Enn3Developer merged 1 commit into
masterfrom
n/player-abstraction
Sep 6, 2026
Merged

refactor: decouple game participants from human players#85
Enn3Developer merged 1 commit into
masterfrom
n/player-abstraction

Conversation

@Enn3Developer

Copy link
Copy Markdown
Owner

No description provided.

@Enn3Developer Enn3Developer added this to the 0.1.0 milestone Sep 5, 2026
@Enn3Developer Enn3Developer added type: refactor Restructuring with no behavior change area: common OpenPolytopia.Common/ shared library area: gameplay Rules, tribes, troops, tech tree labels Sep 5, 2026
@Enn3Developer Enn3Developer self-assigned this Sep 5, 2026
@claude

claude Bot commented Sep 5, 2026

Copy link
Copy Markdown

Claude finished @Enn3Developer's task in 21s —— View job


Summary

Introduces an IPlayer interface so game logic can accept any participant (human or future bot), instead of being hard-coded to the Player record.

Changes

  • Common: Added IPlayer interface (Tribe, Id) in Player.cs; Player now implements it instead of being the concrete type consumers depend on.
  • Common/Gameplay: Game constructor now takes IReadOnlyList<IPlayer> players instead of IReadOnlyList<Player>.
  • Common: TerrainGeneration constructor now takes IPlayer[] players instead of Player[].
  • Tests: Added PlayerAbstractionTest, which defines a TestBot : IPlayer and verifies terrain generation, game start, and turn alternation work with a mixed Player/TestBot roster.

Worth a look

  • Public constructor signatures for Game and TerrainGeneration changed types (source-compatible for callers passing Player[]/lists, but a breaking API change for any external code referencing the old parameter types directly).

@Enn3Developer Enn3Developer added the breaking-change Breaks save format, packet protocol, or public API label Sep 5, 2026
@Enn3Developer
Enn3Developer merged commit 74298a6 into master Sep 6, 2026
11 checks passed
@Enn3Developer
Enn3Developer deleted the n/player-abstraction branch September 6, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: common OpenPolytopia.Common/ shared library area: gameplay Rules, tribes, troops, tech tree breaking-change Breaks save format, packet protocol, or public API type: refactor Restructuring with no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants