I'm using requestAnimationFrame to draw players in my game. One of the players is moving faster than everybody else. I did some checking with him and he told me that his monitor has a 120hz refresh rate. I'm assuming this means has can process frames faster than others resulting in faster movement speed. Any ideas as to how I can get around this?
Thanks
The shim layer used is below:
// shim layer with setTimeout fallback
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
};
})();
There is no guaranteed framerate. However, you can force an approximate framerate using a simple timer: How to solve different FPS in requestAnimationFrame on different browsers?