So, I keep running into some serious lag in my game when I import it to my iPad Air. Its a simple puzzle game, with no more that 100 verts on screen, and post process effects.
I have opacity on the all the buttons and images in all my menus.
Any thoughts on what might be going on, or how to optimize a mobile game are appreciated
Blueprints? C++? If you are using C++ you should utilize the profiling tools (and macros). Even if you are simulating in the editor on a powerful PC it should give you a general idea of where your application is spending the most time. If you are using C++ I would be happy to guide you through the STAT macro process once I get back to my desktop.
Even if you aren’t using C++ you can still use the stat command in the command line to give you a general idea of which thread is the bottleneck.
Im using Blueprints, and I just used the command “stat Unit” and got these results:
I don’t know if you can tell from here what threads is bottlenecked, but I have access to the profiler and a basic knowledge of how to get info from it (I just don’t know where in the profiler to look :P).
You’ll notice that the game thread is taking up 19ms, which is exceptionally high for your type of game. 60fps is ~13ms. This is the CPU game thread. You’ll also notice that the GPU thread is taking up the most time. I imagine you took that screenshot when there were no animations playing, so it is probably even worse when animations play.
I don’t know how to profile blueprints, but a good start would be to open the profiler, run it (so it captures), play the game for about 60 seconds, and then stop PIE. In the first link I gave you (the profiler), jump down to the Main Event Graph section. There you will see the profiled times. You will want to sort it by Inc Time, and from there you can look through it and see what is taking up the most time.
Unfortunately active profiling is something that is extremely difficult for me to walk you through since this is something that varies by game.
So I profiled my game, and came up these results:
Under my GameThread, “Game thread idle time” is 14.452 ms.
I get the idea that this is an engine function that doesn’t have to do with my content, but I’m not sure.
“CPU Stall - Wait For Event” peaked at over 300 ms, many times in multiple different threads.
Again, I feel like these are engine functions, i just don’t know how to optimize them (or even find them for that mater"
Heres the profile I made of my game. I don’t know if you or somebody else has time to check it out, but ill throw it down here anyways:
The fact that you posted your stats is absolutely fantastic. Admittedly I am terrible at reading these (sorting by who made the code is a feature I sincerely wish existed), so take my comments with a truckload of salt.
I am obligated to ask (even though you are still experiencing issues on both your Air and development platform. What OS, CPU, and GPU are you using? Is this using Paper2D?
The fact that your GPU time is high, your Game time is high, and you have a load of CPU Stall events could mean the CPU is waiting on the GPU thread. Something about your GPU could be slowing everything down. I noticed that streaming (files and textures) was taking up quite a large amount of time, but I dont know if the file streaming is due to the profiler.
Anyway, I’m on my laptop right now, so trying to thoroughly look through the stats is quite difficult, so I’ll take another look tomorrow morning when I am back at my desktop. For now let’s start with answers for the questions above.
I’ve taken some time to look through the profiling and I can’t find anything that takes up a lot of time that isn’t a CPU stall. Your frame time averages about 22ms (which is about 45FPS) which is still above what it should be. Below is an image of your game thread. Notice how it is fluctuating a bit and there are certain areas where it spikes.
Below is your rendering thread layered on top of your game thread. You will see that your rendering thread almost perfectly matches your game thread.
Below is the stats thread overlaid the game thread. Make of this as you will - I don’t know how to interpret this.
Below is a single frame where your performance spikes, but every single event is a CPU stall which tells me nothing (I don’t know how to interpret this).
One particular spike is caused by what looks like an autosave with a CharacterMovementComponent.
A skeletal mesh that looks like it goes by the name reddot is taking up quite a bit of time as well.
No idea what this is.
You are publishing to iOS. I looked through some of the iOS project settings in my own project and I noticed that the framerate is locked to 30FPS to save battery. This value is changeable, and 30FPS equals about 33ms, plenty of time to do what you need to do.
At this point it comes back to what your computer’s hardware is and whether you still get performance spikes on another device. Unfortunately any performance issues you get on a single device is not indicative of the actual performance.
Thanks so much for all this! I really do appreciate it
Ill the a look at these objects as soon as I can, and hope it clears some stuff up.
Ill also try to get a profile from my Air, and might try getting a profile from my iPad2 as well to see how the compare.
I feel bad for not giving an update, but I found the problem!
After weeks of profiling and reading through logs, I decided to check my FPS clipping, and guess what it was set to 20FPS. Set it to 60 and my game runs as good as ever.
So, make a note kids, check your FPS clipping before spending weeks learning how to profile, and then feeling really dumb for not realizing you had such an obvious issue.