Skip to content

Add mobile and desktop cross-platform controls with multiplayer support#5

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-mobile-and-desktop-support
Draft

Add mobile and desktop cross-platform controls with multiplayer support#5
Copilot wants to merge 4 commits intomainfrom
copilot/add-mobile-and-desktop-support

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

Implements full mobile and desktop support ensuring multiplayer works seamlessly across devices.

Mobile Controls

  • Virtual joystick: Bottom-left on-screen controller for continuous camera-relative movement
  • Touch-optimized camera: Adjusted sensitivity, pinch-to-zoom, proper radius limits
  • Responsive viewport: Meta tags prevent unwanted zooming, touch-action prevents scroll interference

Desktop Controls

  • Keyboard movement: WASD/Arrow keys for continuous camera-relative movement
  • Mouse controls: Retained click-to-move, drag-to-rotate, scroll-to-zoom

Device Detection & Adaptive UI

Auto-detects device type via user agent and viewport width. UI elements (buttons, text, instructions) scale appropriately. Control instructions update based on detected platform.

Architecture Improvements

Extracted shared movement logic to eliminate duplication:

// Before: Duplicate camera direction and boundary logic in 3 places
// After: Centralized helpers
private getCameraDirectionVectors(): { forward: Vector3, right: Vector3 }
private clampToBoundaries(position: Vector3): Vector3  
private updatePlayerPosition(newPosition: Vector3): void

// Configurable constants
const KEYBOARD_SPEED = 5;
const JOYSTICK_SPEED = 3;
const BOUNDARY_LIMIT = 245;

All position updates flow through updatePlayerPosition() ensuring consistent boundary clamping and server synchronization regardless of input method.

Cross-Device Multiplayer

Desktop (keyboard/mouse) and mobile (touch/joystick) players can join the same game room. All input methods properly synchronized via Colyseus. WebRTC video/audio streaming works across device types.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add mobile and desktop support.</issue_title>
<issue_description>Add full mobile and desktop support with controls.</issue_description>

<agent_instructions>Make sure multiplayer works well across devices.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 24, 2025
Copilot AI and others added 3 commits November 24, 2025 22:36
Co-authored-by: mrhegemon <5104160+mrhegemon@users.noreply.github.com>
Co-authored-by: mrhegemon <5104160+mrhegemon@users.noreply.github.com>
Co-authored-by: mrhegemon <5104160+mrhegemon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mobile and desktop support with controls Add mobile and desktop cross-platform controls with multiplayer support Nov 24, 2025
Copilot AI requested a review from mrhegemon November 24, 2025 22:47
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.

Add mobile and desktop support.

2 participants