tarek2
No, you can not use a tilemap as a replacement for randomly spawning those sprites.
I asked because a tilemap is also a pretty optimised object.
I asked this other questions because C2 has the collisions well optimised.
https://www.scirra.com/blog/ashley/6/co ... on-in-r155
You lose that optimisation if the collision/overlap check is not the first condition in a root event.
Still assuming that we speak about static objects. If you drop the collision cell optimisation, you better bring something in place that is almost as fast. And the only thing (that i am aware off) that is fast enough to beat that optimisation is the Line Of Sight.
But lets compare. Only testing reveals something in C2.
This is a bunch of STATIC objects and one moving sprite. Look in the debugger, and see the collision checks running out of control. Yet, the performance drop is minimal. Well, on my laptop. It is kinda fast, dont know on your device.
https://www.dropbox.com/s/9y6q7s6c4wy73 ... .capx?dl=0
Now, lets bring those collision checks under control. Using LOS.
https://www.dropbox.com/s/zzz5ifttiom7b ... .capx?dl=0
Neglectable collision checks now. You see ? Yet the performance is almost the same. What we won by getting those collision checks under control, we lose by bringing them under control. CPU wise.
Conclusion: Static objects do not kill performance. That is because they have no 'personal ambitions'. If you have a performance drop, it is not because the amount of objects/instances. It depends on how many objects you apply how many 'personal actions' on in 1 tick.
Well, that is my experience so far. I am still no expert though.