M
M
Mertico2017-05-13 17:43:48
JavaScript
Mertico, 2017-05-13 17:43:48

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

2 answer(s)
A
Alexander Masterov, 2017-05-13
@Mertico

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.

N
Negwereth, 2017-05-13
@Negwereth

https://www.npmjs.com/package/raf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question