A
A
alkolove12018-11-23 16:36:19
Java
alkolove1, 2018-11-23 16:36:19

What is the best way to implement a particle system in Java?

Using the LibGDX framework, I made a lot of particles through Array according to the principle
www.libgdx.ru/2013/09/simple-game.html
However, on weak devices, drawdowns occur every couple of seconds due to the garbage collector.
5bf801f2e683e935784011.jpeg
We need a different particle algorithm in order to initialize the array only once at the start of the game, and then twist it.
Here I am interested in the algorithm how to manage such an array.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Alexandrov, 2018-11-23
@alkolove1

Regular means of libgdx ?
In general, libgdx has special recommendations and implementations of basic things for working with memory, incl. special pools.

G
GavriKos, 2018-11-23
@GavriKos

Where did garbage collection come from? Are you destroying old particles and creating new ones? Use the pool - we hide the old ones partially, we get the new ones from the pool and turn them on.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question