ALWAYS test your game on 3 different devices (low/medium/high specs). This might seem obvious but is not. For testing, I mean installing the app from the store. Preview mode gets close to the real specs, but sometimes the app runs slight different from the app (for Android). If you do not test the game and you do not apply good practice regarding events, you will hit a huge wall that will force you to rebuild the whole game. I'm saying that because I hit that wall. The game I was working on years ago would run 60fps per second on my old laptop. On my phone, was not playable, because it was extremely laggy. The suggestions below apply to any game, however, you might skip some of the steps if the game you make is really simple. So, these steps are the ones I'm taking when making a complex/big game.
This is how I improved my games, to make sure they would run fine on mobile:
- Always test several event logic on a separate project, and check for the best performance. Ask the forum if you might think there is a better way to achieve what you are looking for. Someone else might already encounter the same problem.
- Use overlapping and on-collision when is REALLY needed, otherwise, use distance.
Avoid physics if you can replicate it using events or scripts.
- Do not make a frame bigger than 200px if possible (in the animation tool).
- Use groups to organize your events. For example, if you are making donkey kong country, you might want to organize the code as follow:
- Group events regarding the barrel launch
- Group events regarding item
- Group events regarding specific enemies
- For platform 2d, I find out in my case that tilemap would work less efficiently than using tiledbg, here is more info: https://www.construct.net/en/forum/construct-3/general-discussion-7/mesh-distortion-editor-155675
Once you have the groups, enable/disable them based on when they are needed. For example, you might want to enable the group barrel launch when the barrel is on screen, and disable it as soon is not in use.
- It extremely helps to set a really small viewport size and use the scale view. I have noticed a huge increase in performance and the graphic still looks good.
- Set downscaling quality to Low. I do not notice a huge difference with the medium downscaling.
- Once you are happy with the results, start stressing your game by adding hundreds or thousands of objects to see what is the limit.
From my test projects, I was able to run a Donkey Kong Country remake on low-spec devices (like an iPhone 5s), at 60fps per second. My current game, which is pretty complex (like a mix of Super Mario World and Donkey Kong Country) with additional features, such as items inventory, dynamic light, dynamic weather...etc., runs at 60fps on low specs.
Before using the techniques above, the game I'm working on, with a simple graphic, fewer layers, no weather/light, no items, no effects, or no complex events, was running extremely badly on the iPhone 6, lower than 35fps even if the level was really small compared to the huge levels I can make now (with over 3500 objects per level vs the 75 objects).