How can I increase the performance for my mobile endless runner game?
I have got quite some problems with the performance of my endless runner game and I already tried multiple things to fix it.
How it works.
I spawn 1 random tile at a time that loops for 10 tile pieces. After the character leaves one tile the last one gets removed (So there are 10 tiles at the same time on the screen)
What the Tiles contain ![alt text] The biggest Tile contains 10 400x400 floor meshes and 15 sprites.
The 15 sprite locations are randomized in a box collision.
These sprites rotate with the player character location.
The materials only contain a texture sample to base color.
I have 1 directional light and the default sky sphere(the sphere does not even work on older devices)
What I tried to fix the performance
I have given all the meshes and sprites an max draw distance of 5000.
This increased the performance a lot, from 25fps to 50fps and still sometimes drops to 30fps (I am running it on a samsung s5)
I still need to add a exponential height fog/ fog material in the distance to hide the pop in.
But the real issue is that on other lower end devices the performance is lower than 30fps and drops to 25fps. (Tested on Samsung note 10.1 2010 edition)
So to get to the point, Why am I getting stuttering and low fps in general?
Do I render to many meshes at the same time?
Am I using to much ram? (the random fps drops)
Using an outer 3d program to combine meshes will be better. You can simply decrease the vertex count as much as you can within.
Also about Fog question, from what I see on the forums, people use a way to change the color of everything depending on the distance of the mesh. For example everything at distance 10.000 is pure black no matter what, and they are lerped to their normal colors as they get closer.
Asking about it as a seperate question might help you on that part, as I have little to no exp on such a thing, but it is possible? Yes.
Use the profiler to check what takes the execution time the most and try to reduce it, also "stat game" command show summery times. Not sure how profiler works with Android thru, but you can run on PC and try reduce times on PC. Here docs of profiler:
Follow this question
Once you sign in you will be able to subscribe for any updates here