- Home /
Yet Another Mobile Frame Rate Question - Procedural map generation
Forgive me for starting yet another thread on this. I've searched through the forums here and think I'm still missing something basic.
I'm building a first-person game for Android where you're in essence escaping a maze. At the start of the level, I create a maze - a simple one, really, with 25 "rooms" or "tiles", with around 48 vertices per room.

You can then use the gamepad controls to steer and look around, like in an FPS. But on my Galaxy S3, the frame drops to a crawl, sometimes as low as 2fps. Other times it hovers in the 20s; sometimes it spikes up to the 40s. I can't see any reason why, unless that's just the best my little phone can do.
The main game object of the maze is checked as static, and the prefabbed walls and floors are all checked as static as well. Not that I truly understand that; if I'm dynamically instantiating them, does it make any difference if they're marked as static?
I have 3 directional lights that are static and baked. I'm set to Continuous Baking. The scene has a Skybox, and there is some ambient environment lighting, but I've turned off Global Illumination in hopes to improve the frame rate. Still sometimes dropping to 4 or so fps.
My Camera is clipping at 20. Pretty dang modest, I thought.

Is this just the nature of the beast? Or should I be able to tweak something to get better performance? Does it have to do with procedurally generating the map instead of building levels beforehand?
Again, sorry if I missed something in the documentation or the forums. I'm loving Unity, but I've only got about a month or two in it so far.
Answer by Neamtzu · Apr 21, 2015 at 03:10 PM
Hi,
If you have backed lights why do you keep the 3 directional lights in the scene?
Try to combine textures in atlases.
If you're using the same texture for 1 object, use the same material as well.
Use textures in PVRTC_4Bits format.
In quality settings change your current settings to Fast or Fastest, disable the shadows if you're using batched lights or reduce the shadow distance.
Here you ca find some more informations:
Somehow I totally missed "quality settings" in my research. Thanks! I'm also disabling the directional lights since I have the ambien light. The game ain't pretty now, but hopefully it'll still be fun.
Thanks so much!
You should bake the lights in lightmaps and then disable the lights. Unity should create a folder with you scene name where saves the lightmap textures. Here you can find the tutorial (it's for Unity 4.x, but you should be able to adapt it for Unity 5.x): http://docs.unity3d.com/410/Documentation/$$anonymous$$anual/Lightmapping.html
The 3 directional lights are the only lights in the scene besides the ambient skybox light. If I take them out, it... huh, it looks pretty good. I'll try that and the other recommendations you made. Thanks!
Answer by randytayler · Apr 24, 2015 at 06:07 PM
I found my real problem.
The "floor" objects I was generating had rigidbodies attached on accident, so the game was running afoul of massive amounts of physics. I took off the rigidbodies, and the frame rate jumped up to 40-60 fps. I'm very excited.
So, watch out for rigidbodies, everybody. :)
Your answer
Follow this Question
Related Questions
Substance - Procedural Materials - runtime edit - mobile 1 Answer
Procedural Sword Fighting on a mobile device? 0 Answers
Distorting a plane? Best method? 0 Answers
IL2CPP Bug on android 0 Answers
No Procedural Terrain without lags? 2 Answers