Перейти к содержанию

game-runtime-service (C4 Level 3)

Ответственность

  • Загрузка и вызов GamePlugin
  • Валидация и apply actions
  • GameInstance FSM
  • Audit log
  • Publish game.* events

Компоненты

flowchart TB
    subgraph game_runtime [game-runtime-service]
        API[Game API]
        PluginRegistry[Plugin Registry]
        ActionProcessor[Action Processor]
        StateStore[State Store]
        WinChecker[Win Condition Runner]
        AuditLog[Audit Logger]
        EventPublisher[Event Publisher]
    end
    API --> ActionProcessor
    ActionProcessor --> PluginRegistry
    ActionProcessor --> StateStore
    ActionProcessor --> AuditLog
    ActionProcessor --> WinChecker
    ActionProcessor --> EventPublisher
    PluginRegistry --> DiceBoard[dice_board plugin]
    StateStore --> Redis[(Redis hot)]
    StateStore --> PG[(PostgreSQL)]
    EventPublisher --> NATS[NATS]
Компонент Описание
Plugin Registry dict[plugin_id, GamePlugin]
Action Processor Idempotency, validate, apply, persist
State Store Hot state Redis; cold PostgreSQL JSONB
Audit Logger Append-only game_actions
Win Checker Calls plugin.is_finished()

dice_board integration

  • DiceBoardPlugin в plugins/dice_board/
  • Phases: RollDice → AwaitCellChoice → CheckCenter → CheckWin

FR

FR-011–FR-017, FR-030–FR-037