https://limewire.com/d/eHvQx#pseMBFw5XQ Ok now its good !
This is just a superficial analysis, I hope it helped. But I don't have time for a deeper investigation.
I found two problems that caused the game to crash.
- a very large memory leak, after a few minutes of playing it was already taking up 9GB of RAM on my PC.
- a lot of bugs related to achievements, for example, my browser console crashed after a few minutes of playing. Screenshot below.
I can't fix your memory leak because you're using a lot of third-party outdated plugins, I don't know if it's there or not.
Try putting some of the code in separate groups and turning them off, and see if the leak goes away or not.
But I'll help you with the errors with achievements.
Look at the screenshot, you can see that adding achievements takes time, it's not an instant action and you do it hundreds of times in the code and every tick. Here is a screenshot of the part.
That is, half of the load of your game is achievements.
I suggest you check several times a second whether the Steam SDK is connected and only then check whether there is already such an achievement or add it, it is easy to redo.
And in general, it is better to do such events on events that have triggers.
I showed below.
Your version when the timer runs out you spawn butterflies from all the caterpillars and try to add the achievement so many times, but it is terrible.
I suggest you do it like on the screen, the timer runs out you spawn butterflies and only then if the SDK is activated you give the achievement.