Skip to content

Add mobile-optimized settings and controls#183

Open
Calinou wants to merge 1 commit intogodotengine:masterfrom
Calinou:add-mobile-support
Open

Add mobile-optimized settings and controls#183
Calinou wants to merge 1 commit intogodotengine:masterfrom
Calinou:add-mobile-support

Conversation

@Calinou
Copy link
Member

@Calinou Calinou commented Dec 6, 2023

The TPS demo can now run on mobile devices. Basic touch controls are provided (use the left side of the screen to move, right side to look, hold middle-right edge to aim, tap in bottom-right corner to jump). The controls could certainly be improved (e.g. by having a proper virtual joystick), but suffice for testing and benchmarking needs.

When running on a mobile device, the settings menu no longer lists options that have no effect when using the Mobile rendering method. Default settings have also been optimized for mobile if running on a mobile device.

Note: To export the project to mobile platforms, you'll need to enable ETC2 import as requested by the Export dialog when you add an Android/iOS export preset. This is expected, as I've left it disabled to prevent import times from ballooning if you import the project only to run it on desktop platforms.

Preview

Running on a Samsung Galaxy Z Fold4's main display with a stable 30 FPS cap:

Screenshot_20231206_184609_Godot Third-Person Shooter Demo webp

Screenshot_20231206_184711_Godot Third-Person Shooter Demo webp

On this device, it's also possible to have a steady 40 FPS by using lower-than-default graphics settings.

The TPS demo can now run on mobile devices. Basic touch controls are provided.

When running on a mobile device, the settings menu no longer lists options
that have no effect when using the Mobile rendering method. Default settings
have also been optimized for mobile if running on a mobile device.
const CONFIG_FILE_PATH = "user://settings.ini"

const DEFAULTS = {
var is_mobile := OS.has_feature("mobile")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be:

Suggested change
var is_mobile := OS.has_feature("mobile")
var is_mobile: bool = ProjectSettings.get_setting("rendering/renderer/rendering_method") == "mobile"

(Had to make type hint explicit, somehow it wouldn't infer from the == check that it would be a bool.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with this, I still get this error once when playing the project:

ERROR: FSR2 is only available when using the Forward+ renderer.
   at: viewport_set_scaling_3d_mode (servers/rendering/renderer_viewport.cpp:867)

And it's spammed a lot of times in the editor when using the mobile backend on PC.

Copy link
Member

@akien-mga akien-mga Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then this shouldn't be used to handle the mobile controls though - but from what I see in the code currently it doesn't seem to be the case. Maybe is_mobile_renderer might prevent misuse.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with this, I still get this error once when playing the project:

ERROR: FSR2 is only available when using the Forward+ renderer.
   at: viewport_set_scaling_3d_mode (servers/rendering/renderer_viewport.cpp:867)

And it's spammed a lot of times in the editor when using the mobile backend on PC.

Changing the the Project Settings/ General/ Rendering/ Scaling 3D/ Mode/fsr 2.2 to Billinear resolves the spammed error log on the console.

@akien-mga
Copy link
Member

I tested this PR on a Pixel 7a, the main menu works fine but then when in-game the rendering is broken, it renders a plain brownish color, which changes when rotating the camera. Seems like all would-be screen pixels are averaged to one?

@Calinou Calinou mentioned this pull request Dec 18, 2024
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants