Skip to content

🧹 Cleanup: remove the dead pvpQueues matchmaking path + fix the stale CLAUDE.md dev path #10

Description

@longmaolab

Suggested labels: refactor, good first issue

TL;DR (English)

Two small, safe tidy-ups — no gameplay changes, just less clutter to trip over later. 🧹

  • (1) Delete the dead matchmaking path (pvpQueues / pvpResult). It's leftover code that nothing calls anymore — your real matchmaking is the staging-lobby path. Confirmed: the client has zero references to it.
  • (2) Fix the stale path in CLAUDE.md (line 7 points at /Users/andyli/projects/TABS/pvp-game — a different machine/author).

中文详细说明

两个又小又安全的整理活儿,不碰玩法,只是把以后会绊到你的杂物清掉。

(1) 删掉没人用的旧匹配代码(pvpQueues / pvpResult)

你现在有两套匹配逻辑,但只有一套在用:

  • 在用的:staging lobby —— joinStagingLobbylobbyStart(server.js:1118 起)。
  • 💀 死的:旧的 pvpQueues / pvpResult 一套。CLAUDE.md 的架构笔记自己就写了"the old pvpQueues/pvpResult path is orphaned — no client listener"。我也确认过了:客户端 public/game.js 里搜不到任何 pvpResult / joinPvpLobby 引用 —— 服务器在对着空气喊话。

涉及的死代码(都在 server.js,可以放心删):

  • const pvpQueues = {...}(:628)、PVP_WAIT_MS(:629)
  • flushPvpSolo()(:761)、tryPairPvpQueue()(:774)
  • socket.on('joinPvpLobby')(:982)、socket.on('leavePvpLobby')(:1002)
  • disconnect 里清理 pvpQueues 的那段(:1246 附近)

为什么值得删: 现在任何人(包括未来的你)读匹配逻辑,都得先搞懂"到底哪套在用",白费脑子;留着死代码还容易让人改错地方。删掉之后,匹配只剩一条清晰的路径。

验收: 删完 node --check server.js 通过,服务器能启动,从大厅点开始能正常进对局(staging lobby 那条路不受影响)。

(2) 修 CLAUDE.md 第 7 行的过期路径

第 7 行现在写的是:

**ALWAYS cd /Users/andyli/projects/TABS/pvp-game first** ...

这是**另一台机器 / 另一个作者(Andy)**的路径,对现在的环境已经失效;文档里"和 Andy 协作"那段也是同理。建议改成实际路径,或者干脆写成与路径无关的说法(比如"先 cd 到仓库根目录")。

⚠️ 小提醒: 已经有 PR #2 在改 CLAUDE.md(它加的是第 59 行附近的几行,碰第 7 行),所以这俩不冲突 —— 但合并时留意一下顺序就好。


这两件都不碰游戏逻辑,纯粹是让项目更清爽、更好读。很适合拿来练手 👍。你已经把最难的做完了,这只是顺手把桌面收拾干净。加油!🧹

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions