You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a touch input system to make the player walk, run, and trigger an action.
It is common in mobile to add a virtual controller for moving in one screen side (left side, for example), and one or more actions in the other side (right side, for example).
For the movement controller:
A circle appears whenever the user press and hold the screen, with the pressed position as the center of the circle.
While holding, moving the finger far from the circle center makes the player walk in that direction.
When the finger reaches the border of the circle, the player runs.
Releasing the finger the player stops.
Currently the sole action for interacting (in cosy mode) and attacking (in combat mode) is "ui_accept". But that may change by this task. In that case, a tap anywhere in the right side could trigger the action.
Could an addon like Godot Virtual Joystick suit our needs, without being a big dependency to maintain? This one also gives a vector Input.get_vector(&"ui_left", &"ui_right", &"ui_up", &"ui_down") from the virtual controller.
PS Sokoban is another story, maybe we implement that one in a separate issue? One idea is to swipe up, down, left and right for moving in the player inside the sokoban.
I did some "research" this weekend, also known as "playing Turnip Boy Commits Tax Evasion and then realising it is free on Android so I can compare its three control schemes".
Some observations: because the HUD text and icons are small (18px font, 12px diameter for button icons), the input hints can be always visible without harming gameplay. I kind of like the simplicity of doing this. It would remove the need to hide and show the input hints at various points in the game. (Currently we show: directional input & interact at the bottom of Fray's End; Repel in the first ink combat scene; and Sprint at the start of the stealth scene; undo/reset/skip in Sokoban (but not directions).) Personally I think directional input is self-explanatory and we could remove the WASD bindings without any real cost to playability.
The interact prompt is split in two:
An abstract inverted triangle with an ! on it is displayed above the interact target
The first action (A on Xbox joypad, z on keyboard) changes its label from "trip" (a kind of dash) to "interact"
Turnip Boy can only have one item equipped at a time. In the screenshots above, I have a sword equipped, but I can also equip a watering can. If you squint you can see the hilt of the sword over Turnip Boy's back. In the touch controls it's way more obvious of course.
There is no "run" action AFAICT so a simple joystick suffices in touch mode.
The direction of the sword attack (or watering can pour) is based on the direction of movement: there is no separate aim function.
I tried it and... it didn't work. Then I realised why: we handle player movement in _unhandled_input(). But the input event is handled – by the VirtualJoystick!
If I moved the code above in player.gd from _unhandled_input() to _process() then it worked fine.
Assuming that this is the intended behaviour (and is also not just a consequence of emulating touch input from mouse), we will have to rework our input handling – or rather, disabling player movement during dialogue etc. – to adopt this.
I'm going to merge it since I was able to pass the 2 main lore quests using my phone (musician quest, void quest). The decisions I've made are explained in the PR description. I'm going to open followups for better usability and bugs. For instance:
Activity
wjt commentedon Jun 17, 2025
I think we would also want to hide the input hints (at the start of Fray's End) when using touch controls.
wjt commentedon Jul 21, 2025
I did some "research" this weekend, also known as "playing Turnip Boy Commits Tax Evasion and then realising it is free on Android so I can compare its three control schemes".
PC, keyboard
PC, gamepad
Android, touchscreen
wjt commentedon Jul 21, 2025
Some observations: because the HUD text and icons are small (18px font, 12px diameter for button icons), the input hints can be always visible without harming gameplay. I kind of like the simplicity of doing this. It would remove the need to hide and show the input hints at various points in the game. (Currently we show: directional input & interact at the bottom of Fray's End; Repel in the first ink combat scene; and Sprint at the start of the stealth scene; undo/reset/skip in Sokoban (but not directions).) Personally I think directional input is self-explanatory and we could remove the
WASDbindings without any real cost to playability.The interact prompt is split in two:
!on it is displayed above the interact targetzon keyboard) changes its label from "trip" (a kind of dash) to "interact"Turnip Boy can only have one item equipped at a time. In the screenshots above, I have a sword equipped, but I can also equip a watering can. If you squint you can see the hilt of the sword over Turnip Boy's back. In the touch controls it's way more obvious of course.
There is no "run" action AFAICT so a simple joystick suffices in touch mode.
The direction of the sword attack (or watering can pour) is based on the direction of movement: there is no separate aim function.
manuq commentedon Jul 21, 2025
This is a great reference @wjt, thanks.
ItsGianPierre commentedon Sep 5, 2025
I plan to work on this.
manuq commentedon Sep 24, 2025
De-assigning after no response.
wjt commentedon Feb 17, 2026
Godot 4.7 adds a built-in VirtualJoystick control: https://godotengine.org/article/dev-snapshot-godot-4-7-dev-1/#input-virtualjoystick
I tried it and... it didn't work. Then I realised why: we handle player movement in
_unhandled_input(). But the input event is handled – by the VirtualJoystick!threadbare/scenes/game_elements/characters/player/components/player.gd
Lines 164 to 175 in b5c4900
If I moved the code above in
player.gdfrom_unhandled_input()to_process()then it worked fine.Assuming that this is the intended behaviour (and is also not just a consequence of emulating touch input from mouse), we will have to rework our input handling – or rather, disabling player movement during dialogue etc. – to adopt this.
manuq commentedon Feb 17, 2026
Whoa, VirtualJoystick for free! This is great news!
Web export: Switch to fullscreen and landscape (#3012)
Remove touchscreen warning
Remove touchscreen warning
manuq commentedon Oct 15, 2026
In #3016 I have something basic working:
Grabacion.de.pantalla.desde.2026-10-15.10-45-39.mp4
I'm going to merge it since I was able to pass the 2 main lore quests using my phone (musician quest, void quest). The decisions I've made are explained in the PR description. I'm going to open followups for better usability and bugs. For instance:
Touch support (endlessm#3016)