I recently ventured into developing a (another) game extension.
It is the game of the 2-D Mahjong also known as Shisen Sho.
Instead of using Mahjong's classic tiles I thought of using emojis and lotties.
The game is, at least for the first levels of play, within the reach of the kids.
The game difficulty grows with the number of tiles on the board.
User can choose to play with a set of emoji (among animals, food or mahjonh tiles) or with animated lotties.
With emoji I don't have any problem, but when user chooce to play with lotties the use of memory grows a lot and it seems never comes released.
With emojis, the memory consumption is around 40 MB (I see this info hovering mouse over the label of the tab where the game is running).
When instead the tiles are made up of lotties, it starts from a consumption of 40 MB of memory that comes after a 10-12 levels at over 1 Gbytes!
I can't understand where the problem lies.
All the sounds and lotties of the game (mp3 + json files) are previously saved in the storage cache to minimize the loading times.
During the game I tried to inspect the DOM to see if duplicate elements were created that they would have made grow the use of memory but I have not found anything anomalous.
I use this libray for looties
lottie-player.
When I go from a level to another, I destroy the previous game table with "replaceChildren" and build a new game table.
Have any of you ever worked with this type of object? (lotties) and have ever encountered similar problems?
Any advice on how to intercept this kind of issuee with the browser tools and prevent them?
Anyone who wants to take a look at the game can find it at this
URL
TIA