Hello all! I’m facing some performance issues with Phaser, I was hoping someone could help me out. First of all, I’m really noob in Phaser and Game Dev, but I know my ways with javascript as I am a frontend developer.
I’m trying to make a platformer game using Arcade physics and maps from Tiled. It started good but then I started patching some bugs here and there and after many “quick fixes” I think I’m doing a really bad job with performance.
This is an image of a map I’m trying to use in my game, everything loads fine, but when I load the enemies, the framerate drops to half. And in the hero update function I have some custom checks for like holding the jump button to make him jump higher and things like that, but when the game is running super slow and the update function is not called that often, the hero ends up jumping super high, plus some other weird things.
So if I have 10 enemies in screen, they all have their update function, which on every run will look for all tiles in the map, so they can know if they are about to go off a platform. I did this so I can make them go the other way around and just stay in the platform, going from one side to the other. I think this might be one of the biggest problems in my performance, but also, there are so many insane complex games that are played in my phone with 120 fps and I can’t believe that this is giving my browser problems. idk.
I also have custom collisions in my tiled (squares and circles) that loads when the stage is loaded.
Is there a way for when the frame drop I can keep the game speed the same, somehow? Or maybe any other kind of performance tip. Should I wrap some of my update logic into a scene.time.delayedCall or maybe the native RAF or settimeout?
You can play the game here: (choose the first stage) https://blopa.github.io/my-code-sux/
Source code: https://github.com/blopa/my-code-sux
Thanks