I posted this originally over at the old HTML5gamedev forums a year ago upon the initial release but have never posted it here. Yesterday I updated my Tilemap and Filepack Template to be compatible with Phaser 3.17, webpack 4, babel, and implemented pools for the player and enemy projectiles.
The original idea of the template was to illustrate a concept I was trying to explain to another user over at the html5 forums. The idea was to have a single level scene class which dynamically loaded the proper tilemap each time. That way you would not have to have a different scene for each level of the game. It then grew as I became interested in trying out other ideas and Phaser functions until it was essentially a finished small game. I knew a lot less about Phaser 3 a year ago and the documentation, although extensive, was not in the state that it currently is in. As such I am trying to make a concerted effort to go through, clean up, and replace as much code with actual Phaser API methods as I can.
The major point of this release, besides testing against 3.17, was to implement pools for the projectiles so that the game wasn’t needlessly creating and destroying dozens of sprites while the scene was running. I’m not sure if there was a real performance gain but it is definitely the correct way to do it.
I also looked briefly at replacing my custom create from tiled objects method with Phaser’s method but decided it would end up being just as complex if not more since I am checking against the registry to see if the object had previously been picked up or destroyed. I still want to revisit this idea with fresh eyes as I think there is probably a better way of doing it.
Anyway, hope some of you new people find this template informative. As for you veterans let me know if you think there is a way I can improve or simplify something please.