My canvas game is lagging so hard

Hello i was making canvas game but it is lagging so much, im wondering if its caused by drawing game area or key events… if someone help me i will be happy ;-;

game: (move with WASD)

project:

There is few things I can think of,
you either have memory leak in the game,
or you are trying to process a lot of information at the same time.

Open the game, go to chrome devtools, click on performance and then record a few seconds of activity.
It’ll open a performance graph - see if there’s a lot of paints being fired or function being called.

1 Like