Welcome, gamers! If you’ve been following the trends, you know that the mobile game market has been on the rise for a while now. What you may not know is how to make your pretty game stay looking pretty and still run well on phones and tablets, as those work very differently from PCs. On today’s post we will take a quick look into that!
Why optimize?
“But peq, aren’t smartphones super powerful nowadays? My iphone/Samsung/Motorola/brandname has the latest everything!” I hear you say and well, while that might be true, phones AND tablets both are very different from PCs.
Computers use a type of architecture called “x86” while anything mobile usually uses ARM(first one being CISC and the second RISK). Now what does that mean? Well simply put, x86(and other CISC architectures. Think Intel and AMD) have instructions for a BUNCH of things that ARM(and other RISKs. Think Snapdragon) don’t, which means it performs a LOT better, even with similar looking specs, than arm does. On top of that, phones don’t have dedicated GPUs and computers do, which makes graphics a much harder job to smart devices.
Ok, then what do I do?
Don’t worry, it’s not as hard as it seems! As much as phones might be weaker, there are many things you can take advantage of nowadays in pretty much any game engine in other to make it run smoothly while looking pretty much the same.
- Resolution: Even if a phone advertises 4k resolution, it doesn’t mean your game NEEDS to run in 4k. Smartphones have really small screens(and so do even tablets) and those are really far away from the player’s eyes. So, my recommendation? If your game isn’t something like a shooter or a fast paced action game, force the resolution to be 720p. The smaller the resolution, the lower of a toll it’ll take on the device’s GPU.
- Memory: It might be tempting to cache everything in your scripts and use the best textures possible, but don’t. Mobile devices don’t have much memory, and it’s both slow AND shared with their integrated graphics cards. Try to keep memory usage as low as possible, keep only what’s absolutely necessary in cache and if you’re using an engine with auto managed memory such as Unity, be careful with object/variable creation and destruction.
- Textures: Just like with resolution, textures are shown in a VERY small size on the screen, so decrease their size when porting a game to android or iphone. A good rule of thumb if you don’t know how much to decrease them to is: Make it half as much as the PC port. Believe me, it’ll make barely any difference.
- Loading: Phones also have slower storage than PCs and Consoles. A MicroSD is not ANYWHERE as fast as a modern SSD, being usually on pair with old Hard Drives, so load things in a smart way. On unity, for example, you can split a Scene(a level) into multiple separate ones manually, then when you need to load them you can use SceneManager.LoadSceneAsync plus mode=Additive to load all of them in parallel.
- Programming: Just like said before, ARM CPUs don’t have as much processing power as x86, so optimize your scripts. Try to simplify calculations, avoid constantly looking through an object’s values, break out of loops when they aren’t necessary anymore, use less accurate physics calculations, avoid running code on every single frame if possible, etc. The less your CPU is busy, the more frames it can process and send to the GPU to render.