flappy-svg icon indicating copy to clipboard operation
flappy-svg copied to clipboard

Use one timer for the game loop

Open niccokunzmann opened this issue 9 years ago • 8 comments

threading.js uses several timers. This can be reduced to one timer per interval. The problem with many timers is that they tend to schedule differently when you use them for a long time. This can be seen as the obstacles move where they should not.

niccokunzmann avatar Dec 21 '15 20:12 niccokunzmann

Leave a comment of you want to work on this issue.

niccokunzmann avatar Dec 22 '15 10:12 niccokunzmann

will like to work on this.

SilentFlame avatar Feb 04 '16 19:02 SilentFlame

Sure, go ahead!

niccokunzmann avatar Feb 04 '16 22:02 niccokunzmann

how to get started here? as I have no idea about this.

SilentFlame avatar Feb 06 '16 08:02 SilentFlame

If you have a look at threading.js line 38, you see that every action starts its own interval. We can reduce the number of started intervals to only one that performs all actions. That is the idea. How would you go about it?

niccokunzmann avatar Feb 06 '16 09:02 niccokunzmann

@niccokunzmann but looking at the above code you mentioned, it seems every action have its interval set to null, I'm not getting what exactly is it dong here. and which one should be the action which should contain the interval to start all the actions?

SilentFlame avatar Feb 26 '16 19:02 SilentFlame

There will be one timeout for all actions. You can put it in a global variable, if you like.

niccokunzmann avatar Feb 29 '16 09:02 niccokunzmann

@SilentFlame updates pls?

abishekvashok avatar Dec 25 '16 09:12 abishekvashok