News for hackers. Stuff that matters.
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by TronPaul_ on Sunday December 20, 2015 @06:26PM (#10768759)
144hz monitor here. Pretty sure the game is tuned for 60fps and thus 144hz monitor is playing like turbo speed.
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by prezjordan on Sunday December 20, 2015 @06:35PM (#10768790)
Same :) requestAnimationFrame is a very short tick on 144hz monitors.
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by mahsu on Sunday December 20, 2015 @06:58PM (#10768851)
What would be the best way to throttle fps and ensure compatibility between different refresh rates?
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by moron4hire on Sunday December 20, 2015 @07:14PM (#10768884)
You count the time since the last update, wait for the time to accumulate over the update threshold, run the update loop with a fixed time-slice enough times to match whole number of frames. Let the carry over perpetuate to the next frame.

At 144hz with a fixed time-slice set for 60hz, you'd have one update on the 2nd, 4th, 7th, 9th, 12th, 14th, etc. frames.

Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by TronPaul_ on Sunday December 20, 2015 @10:12PM (#10769363)
The best way is usually to not tie game state to frame ticks. See Bethesda's Creation Engine https://www.youtube.com/watch?v=Yuyp-S7FPNI for why that's a bad idea.
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by yoklov on Sunday December 20, 2015 @07:24PM (#10768915)
Does RAF really run at 144hz on those monitors? That's surprising... and means I probably need to fix some code before those get more common.
Re:MariOCaml: HTML5 Mario, written exclusively in OCaml by moron4hire on Sunday December 20, 2015 @07:32PM (#10768936)
It's a W3C recommendation that it runs at the native refresh rate of the monitor. I made a pen not too long ago for comparing different types update loops for different browsers. http://codepen.io/SeanMcBeth/pen/MaMjbZ

I tried to stick to statically allocated values, but there is clearly some sort of GC happening in Firefox. Chrome is stable, but Internet Explorer is extremely noisy.