I have issues with the PvP - multiplayer- the game is simple but i am stuggling - any help is welcome:
Current flow is as following:
┌─────────────────────────────────────────────────────────────┐
│ MULTIPLAYER SEQUENCE │
│ PLANET CONQUEST │
└─────────────────────────────────────────────────────────────┘
LEGEND:
P = Player Client
H = Host Client
C = Other Client(s)
S = Server
──────────────────────── Phase 1: Connection ────────────────────────
P ── PLAYER_CONNECT ───────────────────────────────► S
P ◄─ PLAYER_CONNECTED ────────────────────────────── S
────────────────────────── Phase 2: Lobby ───────────────────────────
H ── CREATE_ROOM ───────────────────────────────────► S
H ◄─ ROOM_CREATED (roomId) ────────────────────────── S
C ── JOIN_ROOM (roomId) ─────────────────────────────► S
H ◄─ PLAYER_JOINED (playerInfo) ───────────────────── S
C ◄─ PLAYER_JOINED (playerInfo) ───────────────────── S
H ── PLAYER_READY ───────────────────────────────────► S
C ── PLAYER_READY ───────────────────────────────────► S
H ◄─ LOBBY_UPDATED (readyStates) ───────────────────── S
C ◄─ LOBBY_UPDATED (readyStates) ───────────────────── S
──────────────────────── Phase 3: Game Start ────────────────────────
H ── START_GAME ─────────────────────────────────────► S
S ── Generate galaxy + seed state ───────────────────► S
H ◄─ GAME_INIT (seed, galaxyData) ──────────────────── S
C ◄─ GAME_INIT (seed, galaxyData) ──────────────────── S
H ── INITIALIZATION_COMPLETE ────────────────────────► S
C ── INITIALIZATION_COMPLETE ────────────────────────► S
S ── All ready? ─────────────────────────────────────► S
H ◄─ TURN_START (turn=1, timeLimit) ────────────────── S
C ◄─ TURN_START (turn=1, timeLimit) ────────────────── S
──────────────────── Phase 4: Turn Cycle (Repeats) ──────────────────
┌─────────────────────────────────────────────────────────────┐
│ TURN_START (turnNumber, timeLimit) │
└─────────────────────────────────────────────────────────────┘
H ── SUBMIT_TURN_ACTIONS (MOVE / UPGRADE / RESEARCH) ─► S
C ── SUBMIT_TURN_ACTIONS (MOVE / UPGRADE / RESEARCH) ─► S
H ◄─ REQUEST_ACTIONS (final chance) ────────────────── S
C ◄─ REQUEST_ACTIONS (final chance) ────────────────── S
S ── Execute turn (movement, battles, production) ───► S
H ◄─ TURN_EXECUTED (results) ───────────────────────── S
C ◄─ TURN_EXECUTED (results) ───────────────────────── S
H ── CLIENT_STATE_HASH ───────────────────────────────► S
C ── CLIENT_STATE_HASH ───────────────────────────────► S
S ── Verify sync / resolve mismatch ──────────────────► S
H ◄─ TURN_START (nextTurn, timeLimit) ───────────────── S
C ◄─ TURN_START (nextTurn, timeLimit) ───────────────── S
(Repeat until victory condition is met)
────────────────────────── Phase 5: Game End ─────────────────────────
S ── Victory condition reached ───────────────────────► S
H ◄─ GAME_ENDED (winner, stats) ────────────────────── S
C ◄─ GAME_ENDED (winner, stats) ────────────────────── S
────────────────────────── Design Notes ─────────────────────────────
but there are many problems with synchronization - any suggestion is appreciated