Let's talk about improving performance on Android and iOS

Hi, let’s talk about performance on Android and iOS.
I need to make technical queries about optimization; It is a recurring query topic in me since I aim to make mobile games (and I think many here too). I have noticed that the profiler is inaccurate and contains some errors in addition to not being able to specify the frame that it is consuming at a certain moment. I’ve also noticed sudden frame drops (drops of a second or less maybe) that wouldn’t correlate to any heavier load of events than had been running so far (I clarify, not related to sound loading or game effects). In fact, the profiler in the moments of greatest demands throws values ​​in a cell phone of around 17-18 ms at most, which would translate into decreasing to 55 FPS at most (the difference would be imperceptible in those small moments), however You see lags that cut off the animations for an instant, and as I mentioned, there is no specific event that consumes more resources at such times.
Regarding tweens, what consumes fewer resources in the hypothetical case that you want to make an enemy disappear after dying (this would be an example but it is applicable to many events that could be executed in both ways)? Use tween to lower the opacity to 0 and remove the sprite or subtract the opacity from each frame using TimeDelta() and then remove all sprites with 0 opacity? Before asking this, I’ve tested it and haven’t noticed a significant difference between the two ways, but it’s important to me given how it would structure a lot of things in the game (in the long run).
On the other hand, I have modified several times structures of mechanics that are more or less complex to find the best way to process everything and improve performance, however things that should give a significant difference theoretically, in practice do not (for example, instead of constantly evaluating positions or pathfindings use timers to execute them). I get to a point where I have modified many things and there is no significant improvement in an average cell phone with 4 gb of ram (modified complete mechanical structures). I have read that the generated APK is based on HTML and this does not always have optimal performance on Android or iOS, but it does have great applicability on multiple platforms. Would compiling and generating a native Android or iOS APK significantly improve game performance or initial load time? I have tried to do a manual compilation and I have not been able to do it, but from someone who has the experience of having done it, can you notice any improvement?

I cannot give you any technical guidance on this, but I do want to clarify:

GDevelop games are HTML5 games made with Javascript using PixiJS and ThreeJS (for 3D). They are then wrapped in electron to build an executable (with Cordova for mobile devices.)

As far as I know, there isn’t a more “Native” android or iOS executable unless you are going to program your game in Swift (for iOS) or Kotlin/Java (not javascript) for android.

From my understanding, the biggest impacts on performance for both mobile platforms are going to be:

  1. Does the device’s GPU and drivers support WebGL
  2. Are your events and assets optimized (No image assets over 1000x1000, no ogg files for iOS, for example)
  3. Are you testing using Network Preview on an iOS device? (As far as I know Safari has very poor WebGL support).

Thanks for the reply.

Does this mean that there is no difference in game performance if the build is done manually and not through the process offered by GDevelop?

In my case I think it is very difficult to significantly optimize what is already optimized. I don’t have large images but I do have many.
Actually, GDevelop personally gave me a huge opportunity to be able to create my games in a very practical and free way. I would like to know if GDevelop really has a limit in terms of mobile games or if it is really possible to make complex games or games with many mechanics and in a way that they work correctly on most cell phones (from android 7 onwards). I have seen some games that have mechanics similar to what I do, or others that have better graphics and other complex mechanics as well and that work well on much less powerful phones (on very old cell phones, even in android version less than 7). Optimization is always important regardless of platform, but is it possible to reach those optimization levels where complex games work well on most mobile phones?
After many attempts in my case, I see that it would be impossible for me to reach those optimization levels, and I would like to know other experiences in the development of mobile games.

This is accurate. Unless you try to compile it into a tech other than Electron, (Tauri, for example) but performance should be identical (although the actual install size footprint might smaller).

Just to clarify here, Android 7 makes up less than ~2% of all android phones. From what I can find, all android OSes older than 10 combined make up less than 22% of all android devices (That can still get on official app stores and be counted, at least: https://gs.statcounter.com/os-version-market-share/android). The last official android 7 device was released in 2017, for example.

I would not be basing your performance off any devices older than android 10 at this point. Especially since most devices on Android 7 or older probably do not support WebGL due to Chromium blacklisting their GPUs by now.

That said, complexity shouldn’t be an issue. The 2 most taxing things that I know of in GDevelop are: Layer/Object effects (which are post-processing shaders) and object selection (poorly optimized object selection conditions can lead to pretty impactful difference in performance.)

  • For example, putting a “Object A is in collision with Object B” above a “Variable “Blah” of Object A is = “Winner”” condition will be much more performance impacting than putting the variable condition above the collision condition. The former has to do coordinates/polygon mesh checks for every single Object A and Object B, make a list of them, and then check all of that list for the variable. The latter just checks the variables of all of the object A, and then only checks the meshes of the remaining (Much less checks)

All of that said, I only know of what others have said on mobile performance, I do not do mobile dev directly myself. I’ve tested some games for folks on an old android 10 device and a new android 12 (now 13) device, and generally do not experience the performance issues that some have seen on much older devices, which is what makes me think GPU support could come into play.

2 Likes

This is good information.

As you say, the effects greatly affect the performance of android cell phones, mainly the blurring ones.

In my case I have limited this as much as possible and if I can, instead of calculating collision I calculate the distance from one object to another, it can fulfill exactly the same function in many cases and it consumes less (limiting execution according to conditions).

With this I do not intend to make games for cell phones with android less than 7 haha. I was referring to the level of optimization of games that have mechanics similar to my game and that they manage to make them work even on such old cell phones. What I’m doing barely works on an Android 11-12 phone.