refactor(server): move shared game logic into games/ and introduce GameConfig system
- Moved common/game.go → plugins/games/rules.go
- Contains GameRules interface, MovePayload, Player abstraction
- Centralizes all reusable game rule contract logic
- Added plugins/games/config.go
- Introduces GameConfiguration struct (players, board size, etc.)
- Added global GameConfig and RulesRegistry maps
- Each game (tictactoe, battleship, etc.) now registers its config + rules
- Updated generic_match.go to use:
- GameConfig for board/players initialization
- RulesRegistry for rule lookup during MatchInit
- Removed hardcoded TicTacToe behavior
- Clean error returns when game param missing or invalid
- Updated folder structure:
/plugins/
/games
rules.go (formerly common/game.go)
config.go
tictactoe.go
battleship.go
/structs
/modules
main.go
- Ensures GenericMatch pulls:
m.GameName, m.Mode, m.Config, m.Rules
directly from config/registry at MatchInit
- Removes old duplicated logic and simplifies how games are registered