---
name: godot-adapt-desktop-to-mobile
description: "Expert patterns for porting desktop games to mobile including touch control schemes (virtual joystick, gesture detection), UI scaling for small screens, performance optimization for mobile GPUs, battery life management, and platform-specific features. Use when creating mobile ports or cross-platform mobile builds. Trigger keywords: TouchScreenButton, virtual_joystick, gesture_detector, InputEventScreenTouch, InputEventScreenDrag, mobile_optimization, battery_saving, adaptive_performance, MOBILE_ENABLED."
title: godot-adapt-desktop-to-mobile
canonical_url: https://skilld.dev/gh/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile
last_updated: 2026-09-29T08:32:40.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/migration-notes.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/migration-notes.md), [references/mobile-port-checklist.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/mobile-port-checklist.md), [references/mobile-port-deep.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/mobile-port-deep.md), [scripts/battery_saver_mode.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/battery_saver_mode.gd), [scripts/dynamic_joystick_spawner.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/dynamic_joystick_spawner.gd), [scripts/gesture_combo_system.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/gesture_combo_system.gd), [scripts/haptic_feedback_manager.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/haptic_feedback_manager.gd), [scripts/mobile_shader_fallback.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_shader_fallback.gd), [scripts/mobile_ui_adapter.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_ui_adapter.gd), [scripts/offline_save_sync.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/offline_save_sync.gd), [scripts/on_screen_keyboard_handler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/on_screen_keyboard_handler.gd), [scripts/resolution_scaler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/resolution_scaler.gd), [scripts/touch_camera_pan_zoom.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/touch_camera_pan_zoom.gd), [scripts/ui_safe_area_margins.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/ui_safe_area_margins.gd), [scripts/virtual_joystick.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/virtual_joystick.gd).
>
> If the user asked to install this Skill, run `npx skilld install thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/godot-adapt-desktop-to-mobile`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/godot-adapt-desktop-to-mobile`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/godot-adapt-desktop-to-mobile --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/godot-adapt-desktop-to-mobile --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Adapt: Desktop to Mobile

Expert guidance for porting desktop games to mobile platforms.

## NEVER Do

- **NEVER use mouse position directly** — Touch has no "hover" state. Replace mouse_motion with screen_drag and check InputEventScreenTouch.pressed.
- **NEVER keep small UI elements** — Apple HIG requires 44pt minimum touch targets. Android Material: 48dp. Scale up buttons 2-3x.
- **NEVER forget finger occlusion** — User's finger blocks 50-100px radius. Position critical info ABOVE touch controls, not below.
- **NEVER run at full performance when backgrounded** — Mobile OSs kill apps that drain battery in background. Pause physics, reduce FPS to 1-5 when app loses focus.
- **NEVER use desktop-only features** — Mouse hover, right-click, keyboard shortcuts, scroll wheel don't exist on mobile. Provide touch alternatives.

---

## Available Scripts

> **MANDATORY**: Read the appropriate script before implementing the corresponding pattern. Do not paste joystick/gesture/UI tutorials inline.

### [dynamic_joystick_spawner.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/dynamic_joystick_spawner.gd)
**MANDATORY for move sticks** — Joystick appears where the user touches the left half (prefer over fixed-position recipes).

### [virtual_joystick.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/virtual_joystick.gd)
Fixed-base stick Control — use when UI art requires a static well; otherwise prefer dynamic_joystick_spawner.

### [gesture_combo_system.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/gesture_combo_system.gd)
**MANDATORY for swipe/pinch** — Duration/distance/multi-touch ratio → signals.

### [mobile_ui_adapter.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_ui_adapter.gd)
**MANDATORY for Control remaps** — Scales/reanchors desktop HUD for thumb reach + density.

### [resolution_scaler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/resolution_scaler.gd)
Adaptive `scaling_3d_scale` to hold 60FPS while keeping 2D UI sharp.

### [battery_saver_mode.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/battery_saver_mode.gd)
**MANDATORY** — `NOTIFICATION_APPLICATION_PAUSED` → `Engine.max_fps = 1` + pause physics.

### [ui_safe_area_margins.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/ui_safe_area_margins.gd)
`DisplayServer.get_display_safe_area()` padding for notches / hole-punch.

### [touch_camera_pan_zoom.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/touch_camera_pan_zoom.gd)
1-finger pan + 2-finger pinch Camera2D.

### [haptic_feedback_manager.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/haptic_feedback_manager.gd)
`Input.vibrate_handheld` + iOS plugin hook pattern.

### [mobile_shader_fallback.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_shader_fallback.gd)
Strip SSS/clearcoat/heavy shading on weak mobile renderers.

### [on_screen_keyboard_handler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/on_screen_keyboard_handler.gd)
Virtual keyboard occlusion → tween UI up. **Use for LineEdit/TextEdit focus** — not a substitute for HUD scaling.

### [mobile_ui_adapter.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_ui_adapter.gd) vs on_screen_keyboard_handler

| Need | Script |
|------|--------|
| Scale/reanchor HUD, spawn virtual sticks, thumb-reach density | **mobile_ui_adapter** |
| OS virtual keyboard covers focused text field | **on_screen_keyboard_handler** (often both: adapter for layout, OSK handler for text fields) |

### [offline_save_sync.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/offline_save_sync.gd)
**MANDATORY** — Persist on App Pause (WM_CLOSE is unreliable on mobile kill).

---

## Touch Control Schemes

### Decision Matrix

| Genre | Recommended Control | Script |
|-------|-------------------|--------|
| Platformer | Virtual joystick (left) + jump button (right) | dynamic_joystick_spawner / virtual_joystick |
| Top-down shooter | Dual-stick (move left, aim right) | dynamic_joystick_spawner ×2 |
| Turn-based | Direct tap on units/tiles | gesture_combo_system (tap) |
| Puzzle | Tap, swipe, pinch | gesture_combo_system |
| Card game | Drag-and-drop | mobile_ui_adapter + drag Controls |
| Racing | Tilt or tap left/right | platform-mobile / Input sensors |

### Port Procedure (ordered)

1. **MANDATORY** [mobile-port-checklist.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/mobile-port-checklist.md) — confirm pre-port inventory and gate rows before remapping controls.
2. Replace hover/right-click/scroll with touch equivalents (decision matrix).
3. **MANDATORY** safe-area + mobile_ui_adapter for 44–48dp targets; keep critical HUD above fingers.
4. Hook battery_saver_mode + offline_save_sync on pause/resume.
5. Enable resolution_scaler + mobile_shader_fallback until device FPS is stable.
6. Deep Android/iOS IAP/permissions → godot-platform-mobile (Do NOT Load full platform skill until control/UI/perf gates pass).

## Edge Cases (checklist)

- Multi-touch index conflicts on dual sticks — track `event.index` per stick
- OSK covering LineEdit → [on_screen_keyboard_handler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/on_screen_keyboard_handler.gd)
- Background kill without save → [offline_save_sync.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/offline_save_sync.gd) (WM_CLOSE unreliable on mobile)
- Notch clipping → [ui_safe_area_margins.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/ui_safe_area_margins.gd)
- Palm touches screen edge — ignore ~50px border taps
- Desktop test builds: handle both `InputEventMouseButton` and `InputEventScreenTouch`

## Device testing (before ship)

- [ ] 44–48dp touch targets on real hardware
- [ ] HUD above fingers (50–100px occlusion)
- [ ] Pause drops FPS + saves on background
- [ ] Stable FPS after [resolution_scaler.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/resolution_scaler.gd) + [mobile_shader_fallback.gd](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/scripts/mobile_shader_fallback.gd)
- [ ] Portrait + landscape safe areas

Full port recipes → [mobile-port-deep.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/mobile-port-deep.md).

## Deep Recipes

> **MANDATORY** when porting beyond the decision matrix: read [mobile-port-deep.md](https://skilld.dev/api/skills-raw/thedivergentai/game-dev-agentic-skills/godot-adapt-desktop-to-mobile/references/mobile-port-deep.md). **Do NOT Load** it for a first-pass control remap.

## Expert Techniques (short)

- Capture store screenshots via `await RenderingServer.frame_post_draw` + viewport image.
- Debug overlay: `OS.get_memory_info()` — do not spam heavy allocs while monitoring.

## Reference

> Progressive disclosure: open Official Documentation links only when researching a specific API;
> load Related Skills when routing work to a peer domain — do not preload the whole lattice.

### Official Documentation
- [Using InputEvent](https://docs.godotengine.org/en/stable/tutorials/inputs/inputevent.html) — Event pipeline and why `InputEventScreenTouch` / `InputEventScreenDrag` replace hover/mouse-motion assumptions on mobile.
- [Mouse and input coordinates](https://docs.godotengine.org/en/stable/tutorials/inputs/mouse_and_input_coordinates.html) — Viewport vs canvas transforms so touch positions land on the same UI/game space as desktop mouse tests.
- [Input examples](https://docs.godotengine.org/en/stable/tutorials/inputs/input_examples.html) — Practical multi-touch and drag patterns that map to virtual joysticks, swipes, and pinch gestures.
- [Multiple resolutions](https://docs.godotengine.org/en/stable/tutorials/rendering/multiple_resolutions.html) — Stretch modes, aspect, and content scale so phone/tablet layouts keep touch targets readable.
- [Resolution scaling](https://docs.godotengine.org/en/stable/tutorials/3d/resolution_scaling.html) — `scaling_3d_scale` / FSR tradeoffs used by adaptive quality when mobile GPUs miss frame budget.
- [Introduction to the 3 rendering methods](https://docs.godotengine.org/en/stable/tutorials/rendering/renderers.html) — Why ports should prefer **Mobile** or **Compatibility** over Forward+ for fill-rate and feature set.
- [Handling quit requests](https://docs.godotengine.org/en/stable/tutorials/inputs/handling_quit_requests.html) — `NOTIFICATION_APPLICATION_PAUSED` / resume lifecycle that mobile OSes use instead of reliable window-close saves.
- [DisplayServer](https://docs.godotengine.org/en/stable/classes/class_displayserver.html) — `get_display_safe_area()`, virtual keyboard APIs, and screen metrics behind notches and OSK occlusion.
- [Using Containers](https://docs.godotengine.org/en/stable/tutorials/ui/gui_containers.html) — Margin/Box/Grid container contracts for safe-area padding and large touch targets.
- [TouchScreenButton](https://docs.godotengine.org/en/stable/classes/class_touchscreenbutton.html) — Built-in on-screen buttons that emit Input actions without custom hit-testing.
- [Exporting for Android](https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_android.html) — Permissions, APK/AAB, and device testing gates after the control/UI port is ready.
- [Exporting for iOS](https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_ios.html) — Xcode export, capabilities, and App Store constraints that catch desktop leftovers late.

### Related Skills

#### Prerequisites
- [godot-input-handling](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-input-handling/SKILL.md) — Shared InputEvent buffering, deadzones, and multi-touch gesture foundations before building virtual joysticks or swipe combos.
- [godot-ui-containers](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-ui-containers/SKILL.md) — Anchors, containers, and minimum sizes so 44–48px touch targets and safe-area margins stay layout-correct.
- [godot-project-foundations](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-project-foundations/SKILL.md) — Feature tags (`mobile`/`android`/`ios`), display stretch, and renderer defaults that every port branch depends on.

#### Complements
- [godot-platform-mobile](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-platform-mobile/SKILL.md) — Deeper Android/iOS platform APIs (permissions, IAP, thermal) once the desktop→touch control remap is in place.
- [godot-performance-optimization](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-performance-optimization/SKILL.md) — Profiling and CPU/GPU cuts when adaptive `scaling_3d_scale` and material fallbacks are not enough.
- [godot-save-load-systems](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-save-load-systems/SKILL.md) — Durable save ownership that hooks pause/resume instead of desktop-only quit notifications.
- [godot-camera-systems](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-camera-systems/SKILL.md) — Camera2D/3D follow and zoom contracts used by one-finger pan + two-finger pinch controllers.
- [godot-shaders-basics](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-shaders-basics/SKILL.md) — Cheaper CanvasItem/Spatial shader paths when stripping desktop-only visual features for mobile GPUs.
- [godot-3d-materials](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-3d-materials/SKILL.md) — StandardMaterial3D feature flags (SSS, clearcoat) that `mobile_shader_fallback` disables on weak renderers.
- [godot-tweening](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-tweening/SKILL.md) — Smooth UI lifts when the OS virtual keyboard covers LineEdits/TextEdits.
- [godot-autoload-architecture](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-autoload-architecture/SKILL.md) — Singleton homes for haptic feedback, battery saver, and offline save sync managers.

#### Downstream / consumers
- [godot-export-builds](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-export-builds/SKILL.md) — Packaging, signing, and CI export presets after touch/UI/perf gates pass on devices.
- [godot-platform-desktop](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-platform-desktop/SKILL.md) — Keep desktop mouse/keyboard paths working when the same project remains dual-input after the mobile adapt.
- [godot-genre-puzzle](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-genre-puzzle/SKILL.md) — Tap/swipe/pinch control schemes that consume the gesture and UI scaling patterns from this skill.

#### Master
- [godot-master](https://github.com/thedivergentai/gd-agentic-skills/blob/main/skills/godot-master/SKILL.md) — Library router and mirrored module entry for discovering this adapt skill beside sibling domains.
