-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
base: master
Are you sure you want to change the base?
Conversation
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be:
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.)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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? |
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:
On this device, it's also possible to have a steady 40 FPS by using lower-than-default graphics settings.