Hello everybody! By and large, mobile processors are a black box for me Unfortunately, I can't know many of the features of these devices. I hope to get some information regarding the features of development for android devices.
If there are people with existing experience in this area, please give basic tips on working with Godot for android.
For example, how many polygons can be allowed in the frame or what should be avoided during development. Thanks for attention.
What are the features of android development?
I posted this before in regards to WebGL development in Godot, but it applies to mobile too. Texture size and compression is a huge problem. You want to use the smallest textures possible that still look okay. Probably not above 2K for a character model, and 1K or below for assets. VRAM compression is needed on desktop for high performance, but it doesn't work on the web. So setting to lossy compression and turning the slider to around 0.7 I found gave the best results.
Real time shadow is too slow. Though it works, I would not recommend it. Use light baking for everything in the environment. BakedLightmap is super fast on mobile and HTML5 (essentially free) and looks substantially better than real time lighting. But you cannot currently mix real time and baked shadow, so use a shadow blob for characters (basically a black circle plane under their feet).
Resolution can be a problem, especially if people play on their phones with hidpi screens or on 4K desktop monitors, it just can't handle it. Even 1080p can be a struggle unless you have a good GPU. That said, on a high end PC system, the graphics and performance are basically the same as desktop native (with some limitations). However, on the web, people are more likely to be using crappy computers or old phones, etc. so I would recommend making the window small, like 540p. Even at full screen, don't use native resolution. You can scale the viewport manually with code, keeping it at a 1080p max is probably safe (or allowing an advanced option for people with high end computers).
Finally, WebGL 2.0 is still very buggy. It's now supported on all major browsers (as of a few months ago) so that is good, but you can't guarantee every user is on the latest browser or operating system version. There are also weird driver/graphical glitches and incompatibilities on mobile. For example, I have a Lenovo Tab 8 (8" Android Tablet) that is not even that old, 2019, but it won't work with OpenGL ES3 or WebGL 2.0. The specs say it is supported, but it has some bunk driver. And you get a black screen after the Godot logo. So you are basically limited to using OpenGL ES2 in Godot (which will export to WebGL 1.0). This is your best bet, though by the time Godot 4.1 comes out with WebGL 2.0, I think the market will be ready.
cybereality Thanks for the advice! Asset textures are better kept in an atlas, as I understand it?
And how are things with the number of polygons in the frame, there are no strong restrictions?
I'm not sure there are any hard restrictions on poly count. Less is better, but even phones can handle a decent amount, so I don't think that is the bottleneck. I mean, you don't want to go crazy, but I don't know there is a specific number of polygons that are a problem (maybe there is, I would have to test it).
cybereality OK, thanks.
2 to 5k polys per character for mobs, 5 to 10k for hero characters.
Megalomaniak Interesting. This is the amount I was considering
- Edited
[
This video is from a Redmi 7. Player and mobs have around 50k vertices, 12k faces. Just one omnilight and without shadows. Central number are FPS.
Unluckily, on other newer and better devices, performance is worse and other issues. I'm working on it, but I feel it has to do with skinned meshes. Avoid them as much as you can.
- Edited
heavyathan Skinned meshes this is mesh+material+animations, am I right??
"One character consists of 50K vertices?" - Thanks, I got it
1) As little bone animation as possible
2) As few different materials as possible - it is better to use an atlas of textures
3) Minimum of dynamic light sources. Plus textures with shadows where appropriate
Yes, more or less these are the general advices.
Anyway, when you have done some stuff, test often to check all is running ok and optimize specific things of your game.
Ah, and don't obsess with "optimized code". Although it's repeated in all places as a mantra, in Android with a non stupid coding the bottlenecks arrive before from hardware/drivers limitations.
And be prepared to have very different performances or weird behaviours in different devices, independent of the theorical capacities of each one.
heavyathan How strange. A more powerful device may produce less performance Or did I misunderstand you?
And yet, isn't a single thread a bottleneck in this case?
Performance can be strange. Like I'm working on something now for the web, and it's actually significantly slower on a new iPad than this $100 Android phone I bought like 3 years ago. Granted it is not 3D, but it uses GPU-accelerated CSS animations.
cybereality This is some kind of random. It turns out that you can focus on some existing device model, at the same time it may not work so well on others. This is bad
Well, for mobile in particular, you really need to test on actual devices. Like for desktop, it is pretty simple to make estimations. Like if your development rig is about twice as fast as your minimum spec machine, and you are getting 120fps, there is a good chance the slower computer will be about 60fps. It is all pretty standard.
On mobile it's like the wild west. There are all different GPU configurations and drivers, and dozens of different companies making phones/tablets and they are not all to spec. For example, I have a Lenovo Tab 8, which is an 8" Android tablet I think from 2018. The GPU itself is decent, and supports OpenGL ES3. But the driver on that model is strange and GLES3 doesn't work. I'm sure it should work hardware-wise, but different vendors or different versions of Android, even with the same hardware, do not perform the same. I think I have like 10 phones at least I use to test.
That said, you can buy one cheaper/older phone from each platform (one iPhone and one Android) and use that as the minimum spec. It won't cover everything, but if you can get it working on the worst case scenario, then it should work on better phones. Though you should have like 1 decent phone just to check (like your personal device).
cybereality You're right! Even if you take one cpu or gpu model, it may turn out that they work at different frequencies, depending on the model.