godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.04k stars 20.19k forks source link

Godot 4 editor running in Linux-on-Android is very slow compared with Godot 3.5 #78998

Open Dr4kzor opened 1 year ago

Dr4kzor commented 1 year ago

Godot version

4.0.3

System information

Android 13 -> Arm64 Linux -> Box64 -> Godot4.0.3 (LinuxX64) Any of the available render

Issue description

Godot4 code editor lags a lot, and any version of Godot 3 does not.

Steps to reproduce

Godot is running inside Android 13 -> Arm64 Linux -> Box64 -> Godot4.0.3 (LinuxX64) All renders (Also tested in Android 13 -> Arm64 Linux -> Box64 -> WineProton -> Godot4.0.3 (WindowsX64)) All renders

I decided to upgrade my projects since Godot 4 is theoreticaly faster, but in reality it is running slower =(

So running any version of Godot 3.X I get really decent fps, the editor is smoth and an empty scene runs at 70+fps. Running Godot 4.0.3 latest stable I get a massive lag and slow down even inside the code editor (typing is really laggy), running an empty scene runs at only 4X fps compared to the 70+ of Godot 3.X, so almost less 40% speed for an empty scene. Started migrating my project to 4.0.3 and everything is slower =(

If anyone is interested in reproducing this issue, first you need a rooted phone or tablet(there is also a proot version for non rooted devices), then you can follow the installation script from https://github.com/Ilya114/Box64Droid, in my case I also installed xfce4 (you need to fix permission for _apt inside /etc/passwd in order to do a apt update.

Note that you can also try this in proot version (no root needed).

Why am I using a Arm Linux to dev on Android phone/tablet? Godot 3 and 4 Editor crashes randomly on android, plus inside the linux I am able to debug the code and its way more stable and supports vulcan 1.3 while the android side only supports 1.1.

It is very strange that typing in the code editor is super laggy and slow, almost to the point that it's painfull to use.

Video anex showing the problem with lag when typing the in the editor as well as the brutal FPS dif. video here

Minimal reproduction project

Just create an empty project and compare the code editor lag and the FPS of a empty scene.

Calinou commented 1 year ago

What are the specs of your device? Godot 4 is expected to be more demanding than Godot 3, especially for the editor itself.

I decided to upgrade my projects since Godot 4 is theoreticaly faster, but in reality it is running slower =(

We don't expect Godot 4 to always run faster than Godot 3, especially on resource-constrained devices. It was the same when Godot 3 was released compared to Godot 2.

Dr4kzor commented 1 year ago

My device is a Xiaomi Pad 5 pro (snapdragon 870 with 8gb ram) running ArrowOS_13.

Despite running on Android I am running a Linux Chroot inside (using termux-x11 as a display)... In my Chroot The Binding of Isaac is always at 60fps+ and a empty Godotproject gives me 4X FPS Forty something. Why does a full fledge game run faster then an empty project?

Zireael07 commented 1 year ago

Godot now has an Android native version of the editor. Can you test that one to check if the issue is Vulkan vs OpenGL or is it the Linux introducing some lags?

Dr4kzor commented 1 year ago

Ok so running Godot3 and Godot4 nativelly always reaches 120 fps and so I can't see any slowdown on the editor.

I decided to test GDScrip running 10 million add operations on a for loop to see if there is any difrence, and Godot4 is on average 1.5X faster (Native, and on Android -> Linux and on Android->Linux->Windows)

So I'm thinking it maybe has something to do with the way the Code Editor renders it's view. (On XFCE4 to get hardware accel on all windows I had to change "use_compositing to false" located on /root/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml Is there a simmilar option that I can change on the Godot4 editor?

Calinou commented 1 year ago

Is there a simmilar option that I can change on the Godot4 editor?

Godot isn't a window manager – it doesn't perform compositing :slightly_smiling_face:

You can try to enable Single Window Mode in the Editor Settings to mimic Godot 3 behavior in terms of windowing, but I doubt this will resolve the issue you're encountering.

Dr4kzor commented 1 year ago

Single Window Mode sadly gave it no improvement =(

Dr4kzor commented 1 year ago

Err you changed the issue name, but I also tested compiling as native arm64 and running it on chroot and it still has the same problem, so its not related to box64....

Calinou commented 1 year ago

The issue is still scoped to running on Linux-on-Android, which is something we may not be able to fix. In general, running other operating systems on Android is best suited for command-line applications or playing old games.

You could test 4.0 alphas, betas and RCs (starting from alpha1) to see if performance regressed at a sudden point, but I'd be surprised.

Zireael07 commented 1 year ago

@Dr4kzor I meant running a native version on Android itself, not compiling to Arm to run it in Linux on android

Dr4kzor commented 1 year ago

@Zireael07 The native version crashes randomly while typing code and its impossible to use the debugger, also I can code in c# or c++ using a linux version, and this is not possible on native android app (that I know of)

Dr4kzor commented 1 year ago

@Calinou Actually it can run The Binding of Isaac at more than 60 FPS, HADES works at around 30 FPS as well, Heroes of HammerWatch at 120 FPS+, and these are fairly recent games, so it should be possible to type on the Godot Editor without any display/input lag as these modern games work really well. Using other apps like Visual Studio Code also works really well.

I'm thinking that people are underestimating the power in our phones/tablets, I compiled Godot4 with all optimizations and stripping debug symbols on a snapdragon 870 in under 22 minutes!

I will test a couple of Godot 4 Alpha and Betas like you sugested to see if It runs faster and will let you know how it went =)

Tested on alpha/beta/rc beta4 and a lot of other random versions and all share the same problem. Tested on stable versions 4.0.0 ,4.0.1 ,4.0.2 ,4.0.3 and these share the same problem, so it seems its not a code regression.

m4gr3d commented 1 year ago

@Zireael07 The native version crashes randomly while typing code and its impossible to use the debugger, also I can code in c# or c++ using a linux version, and this is not possible on native android app (that I know of)

@Dr4kzor The issue with the code editor in the Android editor is known and targeted to be fixed in Godot 4.2 (see https://github.com/godotengine/godot/issues/70751).

The debugger also is a known issue (see https://github.com/godotengine/godot/issues/76583), but one I am having trouble reproducing. If you're running into the same issue, can you provide some additional context to the linked issue.

I can code in c# or c++ using a linux version

The Android editor will add support for GDExtension in Godot 4.2, so c++ coding will be doable via GDExtension.

Ok so running Godot3 and Godot4 nativelly always reaches 120 fps and so I can't see any slowdown on the editor.

I decided to test GDScrip running 10 million add operations on a for loop to see if there is any difrence, and Godot4 is on average 1.5X faster (Native, and on Android -> Linux and on Android->Linux->Windows)

For these comments, were you referring to the Android editor running natively on Android?

Dr4kzor commented 1 year ago

@m4gr3d So for

I decided to test GDScrip running 10 million add operations on a for loop to see if there is any difrence, and Godot4 is on average 1.5X faster (Native, and on Android -> Linux and on Android->Linux->Windows) It was running native on Android 13

About what you said, will we be able to code c++ directly on the android app as well?

m4gr3d commented 1 year ago

To be frank, as Calinou mentioned, this is not a supported set up which means we're unlikely to make much progress identifying the issue and addressing it, so I would rather focus on your goals and see if we can identify and improve on our supported workflows in order to address them.

That said, if for your own interest you want to get to the bottom of the issue on Linux-on-Android, I would suggest reaching for tracing tools (for both code and graphics), and comparing the difference in traces between Godot 3 & 4.

m4gr3d commented 1 year ago

About what you said, will we be able to code c++ directly on the android app as well?

I don't think the editor on desktop platforms support editing and compiling c++ code directly in the editor, so the Android version will have the same limitation. (that's a functionality that would be interesting to support with a GDExtension plugin, though I doubt it'd be simple)