I've encountered a lot of more or less important problems during the last months, but I know there is always a way to fix them or an alternative solution... it is just a matter of time. In term of gameplay implementation, I'm satisfied and can't wait to add new functionalities and the final assets.
But something worries me muuuch more than specific issues: the global "lag" of my game. I don't remember when, but at one moment of the development, the game started to "lag" on my laptop. On my computer at work it seems ok, but that kind of games are supposed to be played on (almost) every computers, aren't they? More generally, whatever the computer, sometimes the game is fluid, sometimes it's really slow... and during "long" sessions, it gets slower over time.
I'd like to share my project (WIP) in order to help you (and me) understand why the result seems so... unstable. Maybe it won't be laggy on your computers, I don't know..
The html game:
The C2 file:
("space" to pause the game and restart a new one, click to drop balls)
At first sight, the projet could seem to be a mess (in which I'm not lost, fortunately), there are a lot of global variables (too much? I don't know), but not too many sprites nor too many physical objects (according to the tutorial I've read about optimization), and I think I destroy all the created objects when they're not useful anymore... I don't display anything extraordinary so where am I wrong? Which fondamuntal mistake did I make?
In addition, I'm actually not sure that the FPS displayed is really consistant with what's happening... Something the FPS seems pretty great while the game is slow... eventually really slow...
I can -eventually- give up some further features, but I really don't want to create a laggy game, I must be confident in what I'm doing, and not beeing afraid by everything I will add in the future in this project...