A new tutorial about taking the SameGame engine and adding in object pooling.
From Emanuele Feronato: "This is an important update to the SameGame series because I making the game endless, allowing you to create most of the games mentioned in the post 10 successful games you can easily create starting from the SameGame engine and I am using object pooling to handle tiles management.
Object pooling is a technique which stores a collection of a particular object that an application will create and keep on hand for those situations where creating each instance is expensive.
In this case, each time you pick and remove tiles, their sprites should be destroyed. Then, new sprites should be created to replace the ones you just destroyed. That is, if you make a four tiles combo, you have to destroy the 4 old sprites and create 4 new sprites. Then you make a 11 tiles combo. This means 11 sprites destroyed and 11 new sprites to create.
Although I am sure Phaser has a good memory management and garbage collection, this can be very resource-consuming in the long run. So the idea is never to delete removed tiles, which will be temporarily stored in a repository (in this case an array) until a new tile is needed, and we just recover the previously stored tile."