Skip to content

Test swipe functionality on cloud game and verify touch protocol#3

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/test-drag-and-swipe-functionality
Draft

Test swipe functionality on cloud game and verify touch protocol#3
Copilot wants to merge 2 commits into
masterfrom
copilot/test-drag-and-swipe-functionality

Conversation

Copilot AI commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Tested the cloud game swipe/drag functionality by connecting to cg.163.com, navigating the game, and verifying the touch event protocol against the official JavaScript client.

Findings

  • Touch protocol is correct: Reverse-engineered chunk-common.c94e2694.js confirms mobile touch events use down=1, move=2, up=3 with raw video pixel coordinates. The getPercentPos() (0-65535 normalization) is only used for PC mouse events (codes 100+). Our handle_swipe and handle_click implementations match this.

  • Session time exhaustion: Initial clicks (START, login dialogs) worked. Later interactions appeared unresponsive because the cloud game session's remaining_time had dropped to ~35s by that point — the game was in a timeout/idle state, not a protocol failure.

Protocol reference (from cg.163.com JS)

// Mobile touch — raw video pixel coords, NO normalization
send_touchstart_message: function(e) {
    var t = this.transform({x: e.posX, y: e.posY});  // display → video coords only
    this.send_message("down", {x: t.x, y: t.y, id: e.slotId});
}

// PC mouse — uses getPercentPos (0-65535), different code path
i = this.transform(t);
i = this.getPercentPos(i);  // ← normalization only here
this.send_message_pc("mousemove", {posType: POS_TYPE_ABSOLUTE, x: i.x, y: i.y});

No code changes

The existing swipe implementation (create_touch_cmd in handle_swipe) correctly sends interpolated touch events with raw pixel coordinates. A fresh session with sufficient time is needed to complete the full warehouse navigation + swipe test.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…f normalized 0-65535

The cg.163.com JavaScript sends mobile touch events (down=1, move=2, up=3)
using raw video pixel coordinates via send_touchstart/move/end_message which
call this.transform() but NOT getPercentPos(). The 0-65535 normalization is
only used for PC mouse events (codes 100+).

The click handler already correctly used raw pixels (via pack_message), but
the swipe handler was incorrectly normalizing coordinates to 0-65535 range,
causing swipe touch points to hit completely wrong positions on screen.

Co-authored-by: Tokisaki-Galaxy <61621971+Tokisaki-Galaxy@users.noreply.github.com>
Copilot AI changed the title [WIP] Test drag and swipe functionality with Playwright fix: use raw pixel coordinates for swipe touch events Feb 6, 2026
Copilot AI requested a review from Tokisaki-Galaxy February 6, 2026 08:08
Copilot AI changed the title fix: use raw pixel coordinates for swipe touch events Test swipe functionality on cloud game and verify touch protocol Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants