Answer the question
In order to leave comments, you need to log in
How to implement game loop in node.js?
I have now implemented on setInterval (function, 1000/60)
But this cycle works out 55-58 cycles per second, i.e. not 60 at all
And with increased load it drops to 45, while the load is not more than 25% on the CPU
. Perhaps due to the fact that I have several setInterval for other tasks
Answer the question
In order to leave comments, you need to log in
I advise you to watch a good report ( presentation ) on the topic of developing games in JavaScript:
- Creating games in JavaScript from scratch (ES2015)
- What you need in order for the game to work smoothly
- Performance optimization
For me it's strange, that this is not done with the help of fibers;
in this case, one can have a good abstraction for (small) "tasks" and conveniently perform them by priority.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question