How to improve performance of Android App?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hunter
:warning: Old Version Published before Godot 3 was released.

I have been working on a game using the Godot Engine for a while now. This is my first project using Godot. I like the engine for the most part, but have found that with lots of collision objects it starts to lag on my phone. The same app works fine on a computer however.

Below is an image of my game.

The large triangles are shooting smaller triangles (bullets) around. When to many of these bullets are on the screen the game starts lagging an unplayable amount. I was wondering if the problem comes from drawing too many sprites, or having too many collision objects, or both. I am also instancing and I wondered if that was slowing the game down. Should I create the bullets programmatically instead of as a scene?

Any tips to help me reduce lag are appreciated!
Thanks in advance.

Did you try exporting the game without collision to verify the problem really comes from physics? You could also profile the game through the remote debugger. Try “Deploy with remote debug”, the small icon on the right of “play scene”.

Which kind of collider did you used for the triangles, and which kind of shape?

Zylann | 2016-10-14 22:41

:bust_in_silhouette: Reply From: eons

Your bullets are areas?

Is normal that a bullet hell lags a game, for mobile you may need other approach, like the one at the Shower of Bullets demo.

Look at this thread, I was testing doing a bullet hell by instancing, each bullet belongs to a barrage node that controls the motion, bullets only store some variables with a script but does nothing by themselves:

https://twitter.com/_eons/status/756904966057492480

Reached 500 bullets on screen on a very old phone by instancing (and 4000 on my old PC), with Shower of Bullets style you may get a lot more.

Now look at this:
https://www.youtube.com/watch?v=bmk9bmBfjX0

If you want the best performance on a bullet hell, is the way to go.

Thanks for the answer!! This was really useful. I looked at the Shower of Bullets and tried to mimic it in my own game. I am getting much better performance now.

Hunter | 2016-10-17 00:51