Live data from Hacker News

A first-person engine in 265 lines of JS

playfuljs.com

21–30 of 99 posts

Re: A first-person engine in 265 lines of JS

#21

It runs really slow for me, like 1 FPS. Firefox 29 on Linux.

Interesting. Does FF 29 on linux perhaps have purely software graphics? It runs much faster than 1 fps on iphones and most androids, 60 fps on modern desktops in safari/chrome, and 30 fps on FF / osx.

Re: A first-person engine in 265 lines of JS

#24

It runs really slow for me, like 1 FPS. Firefox 29 on Linux.

Interesting. Does FF 29 on linux perhaps have purely software graphics? It runs much faster than 1 fps on iphones and most androids, 60 fps on modern desktops in safari/chrome, and 30 fps on FF / osx.

I get terrible FPS with Firefox on Windows as well (Intel Haswell graphics).

Re: A first-person engine in 265 lines of JS

#25

Heh, reminds me of kkrieger - a first person shooter in 100KB for a scene demo. https://www.scene.org/file.php?file=%2Fparties%2F2004%2Fbrea...

If you missed it a couple of weeks ago, this article about its creation was really interesting: http://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-...

( Thread: https://news.ycombinator.com/item?id=7739599 )

Re: A first-person engine in 265 lines of JS

#27
post #23

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

Love it! Thanks, just linked from the article.

Hey thanks, that was fast.

Re: A first-person engine in 265 lines of JS

#28
It is very interesting to me that you need to multiply the distance-to-wall by the cosine of the angle to transform the image from fisheye to normal. It makes me wonder, why is it that our eye in real life sees straight lines as straight, the way this demo renders the image?

To illustrate the question, see https://en.wikipedia.org/wiki/File:Panotools5618.jpg – why do we see the world as in the bottom image instead of in the top one? After all, our eye really is at different distances from different parts of a straight wall, so it sounds logical that we would see the fisheye effect describe in the article. Is the rectilinearity of the image we see caused by the shape of the lens in our eye, or by post-processing in our brain?

Re: A first-person engine in 265 lines of JS

#29

It runs really slow for me, like 1 FPS. Firefox 29 on Linux.

What graphics card/driver combination do you have? It runs decently for me with Firefox 29 on Linux, intel graphics (Sandy Bridge).

It is not using the GPU to do the drawing: https://github.com/hunterloftis/playfuljs/blob/master/conten...

Note that it is using canvas 2d rather than canvas 3d (aka WebGL[1]).

But if you take ray casting to extreme, you end up with Ray Tracing[2], which is kinda expensive. Which is why we had such an effusive conversation a few months ago about hardware accelerated RayTracing[3].

A sample ray traced scene from AlteredQualia[4] (2nd largest[5] contributor to the famous Three.js Library): http://alteredqualia.com/three/examples/raytracer_sandbox_re...

[1] https://developer.mozilla.org/en-US/docs/Web/WebGL/Getting_s...

[2] http://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29

[3] https://news.ycombinator.com/item?id=7425303

[4] https://github.com/alteredq

[5] https://github.com/mrdocob/three.js/graphs/contributors

Re: A first-person engine in 265 lines of JS

#30

It is very interesting to me that you need to multiply the distance-to-wall by the cosine of the angle to transform the image from fisheye to normal. It makes me wonder, why is it that our eye in real life sees straight lines as straight, the way this demo renders the image? To illustrate the question, see https://en.wikipedia.org/wiki/File:Panotools5618.jpg – why do we see the world as in the bottom image instead of…

[deleted]
Post reply on HN