I have a small game in HTML5 that uses socket.io to communicate with a node.js server. Now my problem is that, ever since I did my last update on it it seems to have something "chunk up" in the background making it laggier and laggier the longer it runs. In the update were a few temporary local variables being defined with var(you know, variables that are only used during one function and then not needed anymore) alongside with a lot of other changes. The update actually featured a new jumping system that allowed players to jump higher when holding down the jump button, and that's it. I am not even sure if this update or something else is causing this. Might the "var" have caused it? Or what other reasons might this strange complication have?
EDIT: Some stuff that I think might be the reason for this and some details:
- Temporary variables defined with var.
- I prerender some graphics in the background, however that only happens once, and that's when the game starts.
- The map is infinite, being generated on as you move through it. When it then receives a chunk from the server it keeps that chunk stored in the client, however it also seems to get laggier and laggier even when you stay in the same chunk, not loading any new chunks from the server.
- It has a chat which basically puts a new piece of text into a div every time it receives a message, however it also got progressively laggier when I was alone on the server(in other words: I received no chat messages)