Regarding game performance, I have some objects in the game that are being eliminated during game play
and when the game starts a new round these objects should appear again.
My question is what's the best way to eliminate them, regarding game performance:
Option 1: Make them unvisible and then visible again.
Option 2: Destroy them and create them again.
Option 3: Move them outside the game boundaries (x,y position) and move them back inside again.
Thanks in advance.
Develop games in your browser. Powerful, performant & highly capable.
all three work and are ok to use. option 1 or 3 are best if it needs to happen alot creating alot of objects(2) can hurt performance. but really it only matters if you see a noticeable performance loss
you should check these out they are helpful on performance
https://www.scirra.com/blog/112/remembe ... our-memory
https://www.scirra.com/tutorials/577/co ... imisations
Option 1 & 3, Never destroy objects that you will reuse in the level, creating a object is very time consuming and can affect your performance.
I recomend you to move them outside boundaries so webGL doesnt render them, then disable any collisions or phisics applied to them so the cpu doesnt have to calculate that