Ok, I’ll try to create a minimal version that still slows down and would be easier to investigate. This would ensure that the problem doesn’t come from a specific feature but something deeper.
However:
1/ Just in case => Is there a way to build directly on iPhone when using Windows 11? (looks like I need a Mac to do so)
2/ In addition to the initial loading (which is just the first manifestation of the problem), there are also elements that appear one after the other (not all at once), and a decrease in FPS when clicking on elements (characters, buttons). It’s a general slowdown, even with almost nothing on the screen.
Thanks but it was on mobile (iOS) that I didn’t know where to find the developer tools
Well, I wasn’t too optimistic about the iPhone 6, even though I initially wanted the game to run on it. But now I feel like even with the most powerful device in the world, it would still be laggy.
As discussed in this thread (Framerate dropping when altering the view matrix) regarding profiling, have you tried with a release build of the game? I noticed a bunch of spikes when testing the game, so you might be running into similar issues.
Sorry for the delayed response, but this issue has been severely affecting my motivation, so… I did not have the heart to work on it. I focused on cross-cutting features, such as a localization system, to continue adding useful stuff to the project.
Now my game still takes a long time to load but in 8 languages. (🥲)
Anyway, let’s get back to the issue…
1/ I’m not sure if there’s a connection with the problem mentioned in this thread (in my case, the framerate isn’t the main issue), but what do you mean by the “release build of the game”? Is it this?
If so, then yes, I always use this parameter value (and have always used it… as far as I remember).
2/ Currently, I’m removing elements from the project (I’ll share it once I’ve reached the minimal version), reducing the scope, and adding numerous “performance checkpoints.” However…
3/ …for some reason, the game still runs perfectly smoothly on HTML5 desktop (the loadings are instant), but it takes much longer on mobile.
4/ Just as a reminder (because it’s been a while), the game was working flawlessly on mobile in January. Then, without any apparent reason, with the exact same build, it started lagging in March. This is where things get really strange because a laggy game itself isn’t unusual.
Note: at the moment, I have around 30 loading checkpoints in the scripts (using os.clock), and I noticed something weird: the os.clock values (stored in a table and displayed via print() + debug draw on mobile) are the same on both mobile and desktop, while the scene loadings are much longer on mobile.
It seems like something unusual is happening before everything is fully loaded… but I need to confirm this. I’ll get back to you and share the minimal version once it’s done.
Yes, that’s what we refer to as the “Release” build. We use that setting to turn off some debug functionalities, which is recommended when shipping a game.
Thanks but it was on mobile (iOS) that I didn’t know where to find the developer tools
Also, as a reminder for (e.g. me) reading this thread: the same build, i.e. same game version and same Defold version (1.3.6) started to suddenly load much slower. So it’s not believed to be a Defold specific issue per se.
Have you tried hosting the game somewhere else? To compare the performance?
Have you tried using an older version of the browser?
Or reading about what changes has happened for that browser?
Perhaps it’s JavaScript vs WebAssembly related?
You could try bundling two separate versions: One with only JavaScript, and one with only WebAssembly.
I see now that the bundle dialog doesn’t expose this functionality, so you’d have to modify your dmloader.js a bit to disable wasm loading (i.e. make isWASMSupported
return false).
Indeed, that’s what I’ve been thinking from the beginning. Although Defold could/should take certain external changes into account… as mentioned below.
Yes, I’ve tried hosting the game somewhere else, but there was no difference.
Yesterday, the project was reduced to a single scene with empty scripts.
Overall performance issue
Despite having almost nothing in the project, it still took 4-5 seconds to load on mobile.
I eventually removed the last “advanced” element, aka collection loading via Monarch.
And boom, instant launch.
However, I don’t think Monarch itself is to blame. It seems to be a broader performance issue that affects Monarch in particular, but it’s just a consequence.
I wanted to make sure by displaying some elements frame by frame right after loading (on mobile), but… that’s no longer “possible”, as mentioned below.
Latest iOS update
This morning, after several days/weeks of harassment from my phone, I finally installed the iOS 16.4.1 update (from iOS 16.3.1).
And… and…
The game is smooth again. For real.
As I suspected (with no way to be sure back then), the issue occurred between January and March, which is when I must have updated to iOS 16.3.1 (this update was available at the end of January, I probably updated in February… so it makes sense).
Performance recap
1/ On iPhone X (probably pre-16.3.1, 95% sure): the game runs fine.
2/ On iPhone X (16.3.1): the game has performance issues.
3/ iPhone X (iOS 16.4.1): the game runs fine.
4/ iPad Pro (iOS 16.3.1 to be confirmed!!!): the game runs fine.
=> I’ll ask my friend to confirm if the tablet is indeed on iOS 16.3.1… because that’s strange.
5/ On @anon95708182 's Android devices, the game has performance issues. Samsung Galaxy Tab S on Android 6, an LG K41 phone on Android 10.
(but I have no idea about the power of these devices - are they recent?).
Conclusion
In short, the issue is not fixed, but…I don’t know what the issue really is. It seems there’s something beyond Defold, but I think that’s still something Defold could/should deal with.
I’ll mention it in the survey, but personally, “performance consistency” is my number one concern by far, even more than features and advanced stuff.
Not to mention Android (I think I’ll need to buy at least one Android device), just the thought that two people (one on iOS 16.3.1 and the other on iOS 16.4.1) would have completely different experiences… it’s discouraging. And the fact that I was the only one experiencing this issue, sometimes wondering if I was going crazy, makes it even more discouraging.
Thank you for your answers though!
I would be happy to help identify the issue if I can.
The problem is that I don’t know how to downgrade to iOS 16.3.1, so I won’t be able to run any more performance tests in the very short term (but I will have the opportunity to use the iPad Pro mentioned earlier, which, from what I understand, is still running on iOS 16.3.1… And the game was running perfectly. It’s hard to understand).
I finally installed the iOS 16.1.4 update (from iOS 16.1.3).
Are we talking about iOS 16.4.1 and 16.3.1?
I don’t know what the issue really is. It seems there’s something beyond Defold, but I think that’s still something Defold could/should deal with.
I mean, sure we want to help and if there is anything we can do, we should.
But please be aware it is an uphill battle to anticipate and work with any future changes to the OS’es (both features and bugs) that they can introduce at any point in time.
We will still need the community to help pinpoint any edge cases that we’ve missed.
I know it’s frustrating, but we’ll continue to investigate to see if we can figure something out.
Yes, sorry, I made the confusion several times in my message. Just edited it.
Yes, I understand. Especially since that one was quite sneaky…
I think that as the community grows larger, it will be easier to identify these kinds of issues and react quickly. On this occasion, it was just me (in panic mode) and my unclear explanations.
Anyway, as mentioned above I remain available to help identify the problem (within the limits of my abilities ).
The Samsung is very old, the LG 2020.
Have you got a friend with a recent iphone and a mac you could ask to debug the web page for you (you run Windows, don’t you)?
When I test on my device (iOS 16.3.1), I get a black screen for 3 seconds. Some loading time is expected ofc, but question is where it’s spent.
I also see an extra stall for ~1.2 seconds, where the page isn’t updating, so perhaps there’s a function somewhere that actually takes that amount of time? (If I read the web inspector properly)
I added some prints in the init() functions of the loaded collections, and they arrive at ~2s into the loading, and then there’s another 1s before the loaded collection renders.
I’ll see if I can pinpoint where this time is spent.
Expanding the callstack for that frame in the Web Inspector, it seems there is a call to texSubImage2D that takes ~1.2s.
Aside from uploading less data (e.g. compressing images), there is little one can do to improve the speed of the graphics drivers.
That said, I still feel like the rest of the time: 1.8s is quite long for loading this small scene
Indeed
All the scripts are cleared or deleted, there is really (almost) nothing in the sandbox collection.
Note that the “black screen” is instant when you remove the collection loading via Monarch. That could be a lead, I don’t know…
But as mentioned above, I have the intuition that the loading related to Monarch is more a consequence of a broader performance issue rather than Monarch itself.
Okay, well, it seems like there’s nothing to be done then. Thank you for investigating!
Eventually, all iPhone users will upgrade to iOS 16.4.1+, I suppose (and for now, nobody is playing my game anyway ).
But I’m wondering: let’s say the game is being commercialized and used by other people (B2B clients or hundreds of millions of gamers - nothing less)… everyone yelling at me because the game has suddendly become unplayable etc.
What would happen in that kind of situation? Is there nothing I can do?
Would all HTML5 games in the world start lagging because of this iOS update? Or is there something specific to how Defold builds the game?
Is this a frequent issue with HTML5 builds? Does it also happen with apps?
Without knowing the exact reason for the problem it is really hard to say with any amount of certainty. What I do know is that updates from browser vendors and OS manufacturers occasional contain bugs which affect games.