Commit Graph

3 Commits

Author SHA1 Message Date
tiennm99 d45b1275af refactor: typed proto enums, dead code cleanup, room-join broadcast fix
Protocol type safety
- Add Piece, GameResult, RoomType, RoomStatus proto3 enums; replace
  unsafe string fields in GameMoveSuccessResponse, GameOverResponse,
  RoomCreateSuccessResponse, RoomSummary, WatchGameSuccessResponse.
- Go compiler now rejects typos like "PVP" or "BLACK". protobufjs
  toJSON() serializes enums as UPPERCASE names, so existing client
  comparisons keep working.
- Fixes turn-change bug where lowercase "black"/"white" server strings
  never matched client 'BLACK'/'WHITE' checks, freezing currentTurn
  and blocking the non-starting player's clicks.
- Regenerate Go + JS stubs.

Room-join bug fix
- home.go handleJoinRoom now broadcasts RoomJoinSuccessResponse to all
  players in the room (owner + joiner), not just the joiner. Owner
  can see the player count flip to 2/2 and the Start Game button
  enables. Remove superseded broadcastJoined + GameReadyResponse path.
- client menu-scene _onRoomJoinSuccess: read correct proto camelCase
  field names (roomOwner, roomClientCount, clientNickname).

Dead code removal
- Delete GameReadyRequest/Response proto messages entirely; leaveRoom
  notifies via ClientExitResponse.
- Delete server/network/{network,wss}.go empty stubs.
- Delete server/pkg/consts/ unused re-export package.
- Slim server/consts/const.go from 117 LOC to 24: drop legacy TCP
  constants, duplicated RoomType/RoomStatus enums, Error/NewErr types,
  StateJoin/StateCreate=0 type-unsafe aliases, unused GameTypes maps.
- database/player.go: remove unused IP, Mode, Type, Amount, legacy
  private state field.
- Fix gopls findings: unused forPlayer, gameOverOnce, runAIMove player,
  handleGameReset player params.

go vet + go test ./... green, npm run build green.
2026-04-11 16:03:21 +07:00
tiennm99 bb799da2c5 feat(proto): port caro protobuf schemas with com.miti99.gomoku.proto namespace
Copies request.proto and response.proto from caro, renames package to
com.miti99.gomoku.proto, drops Java options, adds go_package option,
and appends SpectatorCannotActResponse (field 21) to the Response oneof.
2026-04-11 12:40:45 +07:00
tiennm99 1ce619ba4c chore: add skeleton directories for future phases
common/proto/, server/game/, server/protocol/, client/src/{config,scenes,
services,objects,ui,generated} — all .gitkeep placeholders.
2026-04-11 12:07:25 +07:00