News for hackers. Stuff that matters.
Re:A first-person engine in 265 lines of JS by s-macke on Tuesday June 03, 2014 @04:59PM (#7842694)
My raycast engine in Javascript needs a few more lines and works a little bit different, but gives also impressive results I think :) .

http://simulationcorner.net/index.php?page=comanche

Re:A first-person engine in 265 lines of JS by pascalo on Tuesday June 03, 2014 @10:09PM (#7843659)
Love that you referenced Comanche ... my favorite helicopter game ever. Nice work on the JS side also!
Re:A first-person engine in 265 lines of JS by s-macke on Tuesday June 03, 2014 @10:56PM (#7843784)
The graphics were impressive, but the gameplay never touched me. Comanche 3 was much better.
Re:A first-person engine in 265 lines of JS by nppc on Tuesday June 03, 2014 @07:46PM (#7843344)
I really like how your code uses much less cpu than that of the article. whats the trick ?
Re:A first-person engine in 265 lines of JS by s-macke on Tuesday June 03, 2014 @08:17PM (#7843428)
Don't know. But here some possibilities:

1. No fullscreen

2. I update the screen only if a key is pressed.(No rain, that has to be rendered all the time)

3. I don't use any costly canvas functions. I render everything myself in a pixelbuffer.

4. Typed arrays

Re:A first-person engine in 265 lines of JS by hunterloftis on Wednesday June 04, 2014 @01:33AM (#7844172)
It's #2. Redrawing at 60hz (or as close as the machine can come) is what hits the cpu so hard.
Re:A first-person engine in 265 lines of JS by s-macke on Wednesday June 04, 2014 @03:04AM (#7844352)
No, I don't use requestAnimationFrame right now. I think when I wrote it, it was not supported by IE. But can't remember.

I calculate as close as the machine can but with a window.setTimeout(Update, 0); in order to be responsive.

Re:A first-person engine in 265 lines of JS by philjackson on Wednesday June 04, 2014 @08:26AM (#7845141)
Very cool. Comanche was an excellent game too.
Re:A first-person engine in 265 lines of JS by hunterloftis on Tuesday June 03, 2014 @05:04PM (#7842712)
Love it! Thanks, just linked from the article.
Re:A first-person engine in 265 lines of JS by s-macke on Tuesday June 03, 2014 @05:09PM (#7842738)
Hey thanks, that was fast.