Live data from Hacker News

A first-person engine in 265 lines of JS

playfuljs.com

1–10 of 99 posts

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

#4
> Rain is simulated with a bunch of very short walls in random places.

This made me laugh. I would have never thought of that way of doing it, but before I knew how it was implemented, I didn't even notice! That's a pretty good approximation!

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

#5
post #3

As someone with no experience in computer graphics it's always insane to see demos like this. Especially using just around 250 lines of javascript. Really impressive. Also on the topic, the demo scene stuff is mind blowing, too. [0] [0]: http://awards.scene.org/awards.php

The nice thing about this implementation is that the code is very clear and easy to follow. You could easily make it much shorter if that were the goal.

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

#6
That's really impressive.

I've seen some people suggest that voxels are like sprites for 3d programming (as far as sheer simplicity goes), but this strikes even more so as that. How does this compare to using actual 3d/voxels? Can you still have interesting physics or do you miss out on a lot?

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

#7
I know that the arrow keys have actual arrows on them, but so many modern games have trained us to use WASD to navigate, that if you're going to insist upon the arrow keys for navigation, you should probably mention this somewhere before the link to the demo.

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

#8

That's really impressive. I've seen some people suggest that voxels are like sprites for 3d programming (as far as sheer simplicity goes), but this strikes even more so as that. How does this compare to using actual 3d/voxels? Can you still have interesting physics or do you miss out on a lot?

Thanks! As with most software decisions, raycasters involve a tradeoff. They are related to voxels in that they impose constraints on what can be rendered. Voxels render grids in 3 dimensions while raycasters (typically) render them in 2.

For this reason, you can generally build a raycaster faster and simpler than either voxels or meshes, but there will be things you can't do. Rotation on the x axis is tricky, for example.

It's probably best to think of physics in a raycaster as the same sort of physics you could apply in a top-down 2D game.

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

#10
post #7

I know that the arrow keys have actual arrows on them, but so many modern games have trained us to use WASD to navigate, that if you're going to insist upon the arrow keys for navigation, you should probably mention this somewhere before the link to the demo.

done!
Post reply on HN