Issues

Issue #237 resolved

Particle System performance

Alex Szpakowski
created an issue

The performance of particle systems in LÖVE is not on par with what I would expect - even having a few simple particle systems for weapon hit effects greatly impacts the framerate of my games.

I don't know much about OpenGL or how LÖVE uses it, but I'm fairly sure there is plenty of room for improvement in the particle system code (VBO's?)

Comments (12)

  1. rude repo owner

    Basically true.

    If I remember correctly, ParticleSystem uses many immediate mode calls for each particle. It would be much better to use a vertex array.

  2. Alex Szpakowski reporter

    I tested out a change which improves performance a fair amount with little code modification: using the changes and test .love attached below, frametime went from 16ms down to 12ms on my Intel HD 3000, and from 9ms down to 5ms on my AMD 6750m.

  3. Alex Szpakowski reporter

    I improved performance even more by using a single vertex array to draw all particles in a particle system. I now get 8.6ms with my HD 3000, and 3.25ms with my AMD 6750m.

    Some stats when using just 500 particles instead of 5000:

    Intel HD 3000

    • 0.8.0: 1.6ms doing nothing, 3.05ms drawing particles

    • my changes: 1.6ms doing nothing, 1.7ms drawing

    AMD Radeon HD 6750m

    • 0.8.0: 1.5ms doing nothing, 2.3ms drawing

    • my changes: 1.5ms doing nothing, 1.57ms drawing

  4. Alex Szpakowski reporter

    Commit 77889bd applied my performance-improving patch.

    Particle systems are tricky on framerate even in meticulously optimized AAA games. During my testing I found that rendering a scaled down particle system to a half-screen sized canvas, and then rendering the canvas scaled up to the screen improved performance a ton on large particle systems.

    I went from 8.6ms per frame (using the latest performance improvements) down to 2.2ms with my 5000-particle test when using my Intel HD 3000, just by doing the aforementioned canvas optimization.

  5. Log in to comment