🎯

hytopia-mobile

🎯Skill

from abstrucked/hytopia-skills

VibeIndex|
What it does

Enables mobile game support in HYTOPIA SDK by providing touch controls, device detection, responsive UI, and cross-platform compatibility.

πŸ“¦

Part of

abstrucked/hytopia-skills(12 items)

hytopia-mobile

Installation

Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='*'
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='*' -g
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='hytopia-entities'
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='hytopia-world'
πŸ“– Extracted from docs: abstrucked/hytopia-skills
1Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

Helps implement mobile support in HYTOPIA SDK games. Use when users need touch controls, mobile UI, device detection, or cross-platform compatibility. Covers mobile controls, touch input, and responsive UI.

Overview

# HYTOPIA Mobile Support

This skill helps you implement mobile support in HYTOPIA SDK games.

Documentation: https://dev.hytopia.com/sdk-guides/mobile

When to Use This Skill

Use this skill when the user:

  • Wants to add mobile controls to their game
  • Needs to detect mobile devices
  • Asks about touch input handling
  • Wants to create responsive UI for mobile
  • Needs cross-platform compatibility
  • Asks about mobile-specific button layouts

Mobile Basics

Automatic Features

HYTOPIA handles automatically:

  • Cross-platform play (mobile + desktop together)
  • Game state consistency across devices
  • Movement joystick (left 40% of screen)
  • Camera control (right 60% of screen)
  • Landscape orientation enforcement

What You Must Implement

  • Custom action buttons (shoot, jump, interact)
  • Mobile-optimized UI sizing
  • Touch-friendly button layouts

Mobile Detection

CSS Detection

HYTOPIA adds .mobile class to on mobile devices:

```css

/ Desktop-only styles /

.desktop-controls {

display: block;

}

/ Hide desktop controls on mobile /

body.mobile .desktop-controls {

display: none;

}

/ Mobile-only styles /

.mobile-controls {

display: none;

}

body.mobile .mobile-controls {

display: flex;

}

```

JavaScript Detection

```typescript

// Check if running on mobile

if (hytopia.isMobile) {

setupMobileUI();

} else {

setupDesktopUI();

}

// Conditional logic

function showControls() {

if (hytopia.isMobile) {

showTouchButtons();

} else {

showKeyboardHints();

}

}

```

Mobile Controls

Input Simulation

Use hytopia.pressInput() to simulate keyboard/mouse input:

```typescript

// Simulate key press

hytopia.pressInput('space', true); // Key down

hytopia.pressInput('space', false); // Key up

// Simulate mouse click

hytopia.pressInput('ml', true); // Left mouse down

hytopia.pressInput('ml', false); // Left mouse up

hytopia.pressInput('mr', true); // Right mouse down

```

Creating Mobile Buttons

```html

```

Complete Mobile Control Layout

```html

```

Responsive UI Design

Scaling for Mobile

```css

/ Base UI /

.game-hud {

font-size: 16px;

padding: 10px;

}

/ Larger touch targets on mobile /

body.mobile .game-hud {

font-size: 20px;

padding: 16px;

}

/ Minimum touch target size: 44x44px /

body.mobile button,

body.mobile .touchable {

min-width: 44px;

min-height: 44px;

}

```

Hiding Desktop Elements

```css

/ Keyboard hints - desktop only /

.keyboard-hint {

display: inline-block;

}

body.mobile .keyboard-hint {

display: none;

}

/ Simplify mobile UI /

body.mobile .detailed-stats {

display: none;

}

body.mobile .simple-stats {

display: block;

}

```

Safe Areas

```css

/ Account for notches and rounded corners /

body.mobile .mobile-controls {

padding-bottom: env(safe-area-inset-bottom, 20px);

padding-right: env(safe-area-inset-right, 20px);

}

```

Testing Mobile UI

Browser Developer Tools

  1. Open game at play.hytopia.com
  2. Open Developer Tools (View β†’ Developer Tools or right-click β†’ Inspect)
  3. Click mobile device icon in dev tools toolbar
  4. Switch to landscape mode
  5. Refresh the page (required for mobile detection)

Testing Checklist

  • [ ] Buttons are large enough (44px minimum)
  • [ ] Buttons don't overlap joystick area (left 40%)
  • [ ] UI readable in landscape
  • [ ] Touch feedback visible (active states)
  • [ ] No accidental touches on UI while playing
  • [ ] Important info visible above action buttons

Best Practices

  1. Design desktop first - Then adapt for mobile
  2. Use e.preventDefault() - Prevents unwanted browser behavior
  3. Large touch targets - Minimum 44x44px for buttons
  4. Visual feedback - Show active/pressed states
  5. Right side placement - Action buttons on right 60% of screen
  6. Avoid overlapping - Don't place UI over joystick/camera areas
  7. Test on device - Browser simulation isn't perfect

Common Input Keys

| Input | Key |

|-------|-----|

| Space/Jump | ' ' (space) |

| Left Click | 'ml' |

| Right Click | 'mr' |

| WASD | 'w', 'a', 's', 'd' |

| Interact | 'e' |

| Reload | 'r' |

| Sprint | 'shift' |

Common Mistakes

  • Forgetting e.preventDefault() in touch handlers
  • Making buttons too small for fingers
  • Placing buttons over joystick area
  • Not testing on actual mobile devices
  • Forgetting to refresh after enabling device simulation

More from this repository10

🎯
hytopia-multiplayer🎯Skill

Enables seamless multiplayer game development in HYTOPIA SDK by providing comprehensive player management, networking, and state synchronization tools.

🎯
hytopia-world🎯Skill

Programmatically builds, generates, and manages worlds in HYTOPIA SDK with advanced block placement, terrain generation, and world editor integration.

🎯
hytopia-entities🎯Skill

Generates and manages game entities in HYTOPIA SDK, enabling creation of interactive objects, NPCs, and game elements with advanced lifecycle and component management.

🎯
hytopia-assets🎯Skill

I apologize, but I cannot generate a description without seeing the actual repository or skill details. Could you provide more context about the "hytopia-assets" skill from the "abstrucked/hytopia-...

🎯
hytopia-physics🎯Skill

I apologize, but I cannot generate a description without seeing the actual context or details about the "hytopia-physics" skill. Could you provide more information about what this specific skill do...

🎯
hytopia-events🎯Skill

Handles game events and input in HYTOPIA SDK, enabling responsive player interactions, chat commands, and game lifecycle management.

🎯
hytopia-persisted-data🎯Skill

Enables persistent data storage and retrieval for HYTOPIA SDK games, supporting global game configurations and per-player progress tracking.

🎯
hytopia-debugging🎯Skill

Debugs HYTOPIA SDK games by providing performance metrics, error tracking, client debugging tools, and comprehensive logging across client and server environments.

🎯
hytopia-plugins🎯Skill

I apologize, but I cannot generate a description without seeing the actual repository or having details about the "hytopia-plugins" skill. Could you provide more context or share the repository con...

🎯
hytopia-camera🎯Skill

I apologize, but I cannot generate a description without seeing the actual code or context of the "hytopia-camera" skill. Could you provide more details about the skill's functionality or share the...