News for hackers. Stuff that matters.
Re:JavaScript Wolfenstein 3D Engine by I_got_fifty on Thursday August 06, 2009 @05:26PM (#746441)
How do they do it? Is each frame created with HTML/CSS?
Re:JavaScript Wolfenstein 3D Engine by e1ven on Thursday August 06, 2009 @05:30PM (#746446)
The CANVAS tag allows per pixel placement. It's what makes things like this possible.

From the Source-

This file is part of the article series by Jacob Seidelin about creating a ray casting engine with JavaScript, DOM and Canvas.

If you have questions or comments, please contact the author at either [email protected] or http://blog.nihilogic.dk/

The code samples here are freely available under the MIT license. See: [http://www.nihilogic.dk/licenses/mit-license.txt]

The graphics for sprites and walls are property of id Software.

Re:JavaScript Wolfenstein 3D Engine by axod on Thursday August 06, 2009 @05:40PM (#746465)
>> "It's what makes things like this possible."

You could, and I've seen, versions that use loads of <div> elements which get resized, or you could use a ton of <img> elements. So it's certainly possible without canvas, but I'm not sure how the frame rate would compare.

Re:JavaScript Wolfenstein 3D Engine by TrisMcC on Thursday August 06, 2009 @05:51PM (#746495)
Check the source. This one is done without canvas, and with div and img elements. The canvas elements used here are for the minimap.
Re:JavaScript Wolfenstein 3D Engine by ars on Thursday August 06, 2009 @06:35PM (#746581)
It's png sprites:

http://devfiles.myopera.com/articles/650/walls.png http://devfiles.myopera.com/articles/650/lamp.png http://devfiles.myopera.com/articles/650/tablechairs.png http://devfiles.myopera.com/articles/650/guard.png

You use the piece you want then scale it. For distance, make it smaller, for viewing something that is on the side you shrink it in width while leaving the height alone, this gives the illusion that it is slanted.

It would not be possible to do true 3d with this because you would need to scale something into a trapezoid which HTML can not do.

The guard png implies that you can shoot (and get shot), but I could not get that to work. By the name of the URL looks like there should be a step 6.