- Home /
how do i make my game run more smoothly?
So I released a game on the android market and it seams to have this very strange issue on some phones and tablets. It pixalates everything and runs super glitchy. Anyone have this problem or know how to fix it? the game is minemaze if you need to test it to see for yourself.
Update:
Just got the information, it is a Motorola droid 3 running on android 2.3.4 gingerbread. As for the the game, it is a 3d first person game, no multiplayer. Problem is still persisting after I did more optimization. Game is now running over a thousand fps in the editor haha. Still no luck on this individual case.:
So I reduced all the textures to compressed format with a size limit of 512x512 except for some nontiling textures at 1024x1024. The game is running silky smooth at over a thousand fps and still looks fantastic. No luck on the problem though. This continues to be a very intriguing problem.
Answer by DESTRUKTORR · Apr 28, 2013 at 09:35 PM
Performance can be a tricky thing to master, with mobile devices, and without knowing about how you've set up the game, and given I don't have an android, there's no way of knowing, from where I stand, exactly what the issue is. However, here are some pointers on pinning down performance issues, with unity:
As with any program, look for non-IEnumerator loops (loops that are not handled on another thread, or at least don't behave as though they were) and inefficient algorithms in your code that might be hogging the processor's time.
Reduce the number of "dynamic" method calls as much as possible. This includes, but is not limited to,
GetComponent
,SendMessage
,BroadcastMessage
,GameObject.Find
,FindObjectOfType
,FindObjectsOfType
, etc. Unity is full of expensive, but deceptively convenient built-in methods and functions.Reduce memory overhead - If you can accomplish the same logic with less variables, within an acceptable (or lower) amount of time, do it.
If you're not sure if something is causing the delays, try a stress-test. For example, if you suspect a specific method of causing the delay, try writing another method to call it a very large number of times (on the order of 1000 or greater, is best), and run a clocking system to test how long it takes (c# has the StopWatch class, for this).
Make sure you're using ONLY mobile-friendly shaders! By the sounds of things, this may well be your problem, but, again, without any input from you, I can't be sure.
Thanks for the reply! I am using all mobile shaders but I did find however that I never set up the performance settings. I made sure there was only one setting that had good quality but not slow and the fps shot through the roof unlike before. SO possibly the devices that were having the issue thought it had enough power to run the highest settings. Anyways, need to get my hands on some testing devices that were having some problems and see if the problem has been solved.
I should point out that IEnumerator loops are also run on the main thread, just potentially spread out across frames.
Ahh. Well they behave as though they were running on multiple threads, whydoitdoit XD
No they really don't. They don't run in parallel, there is no need to lock access to variables and an infinite none yielding loop in one will totally crash the program.
That's not what I meant T_T What I meant was the -desired- behavior of "sharing" processing time is there... The fact is that if you run something in a while loop within an IEnumerator, with a yield return, it will still allow other things to run, in s$$anonymous$$d of just holding up the processor, similarly to what one might make a separate thread to accomplish.
Your answer
Follow this Question
Related Questions
android project issue/error/problem...help!! 0 Answers
Problem parsing the package - android 1 Answer
App restarts Android device on launch 1 Answer
iPhone 4 game lags 2 Answers
How do I make a double tap for android? 0 Answers