Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mobile-optimized settings and controls #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.
@@ -14,31 +14,32 @@ enum GIQuality {

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.

@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?

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.

2 participants