Skip to content

Add a built-in virtual controller for easier game development on mobile devices #11193

Open
@Calinou

Description

@Calinou

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

When developing games on a mobile device, you can't test your game until you implement dedicated touch controls for it. This can be an issue if the game is primarily targeting desktop platforms (and keyboard/mouse/controller input only), where adding dedicated mobile controls is not worth the effort.

This is also an issue for the official demo projects, as many of these are currently not usable on mobile platforms due to a lack of a touch controls implementation.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a built-in virtual controller for easier game development on mobile devices. The outcome would be similar to what emulators typically provide for people playing without a physical controller.

This virtual controller would be toggled with a project setting, and its visibility can be toggled at runtime by calling a function (so that it can be hidden in menus). It could also have a project setting that makes it disappear if no touch input occurs for a few seconds, so that it gets out of the way during cutscenes and the like.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This proposal depends on #11192 (and preferably #3976 too, although it's not a strict requirement).

Using TouchscreenJoystick and TouchscreenButton nodes, implement a built-in gamepad layout that can be toggled at any time. However, unlike these nodes, there would be special behavior to make these nodes emulate gamepad input actions instead. This means that you can run any game that has gamepad support using touch controls, even if the game was not specifically designed for it.

The default layout would roughly follow a physical game controller's shape, as seen in many emulators. Further customizations (such as hiding buttons that a game doesn't need or making some buttons toggles) could be provided later on if needed.

This would be a cross-platform alternative to GCVirtualController which is only available on iOS (and lacks an Android equivalent as of writing).

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

This is about improving the game development experience on mobile devices.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions