Monday, July 6, 2009

Ray casting in Flash

Ray casting is a technology used in many old ‘3D’ games such as Wolfenstein 3DDOOM. Game engine use ray casting is also called a 2.5 D engine. The limitation of a simple ray casting engine in Wolfenstein 3D is that you can't look up or down – you can’t rotate X axis. Ray casting is fast and simple so before flash 10 which supports 3d, many people used this technology to make some 3D effect. Ray casting can easily create a maze-like world of walls. You can render terrains, too. Terrain rendering is much different from walls, it is also called voxel rendering.

Here are some information about voxel terrains and volume rendering:

http://bruce-lab.blogspot.com/2009/01/terrain-rendering-in-flash.html

Ray casting is different from mode7, mode7 is much more simple, good at rendering floors or grounds, but can’t do with walls.


I collected some good examples of flash based ray casting:

1.Wolfenstein 3D flash ported by Glen Rhodes

Flash ray engine

http://www.glenrhodes.com/wolf/



2. Andre Michelle’s ray caster(source available)


(1)AS3 version




(2)old as2 version

http://recycle.andre-michelle.com/as2/packages.zip

You can find the source in ‘fla/examples/pro/raycasting’



3.fast ray casting engine(source available)
http://git.runtimeterror.com/?p=rayfaster1.git;a=summary





4. half baked ray casting (source available)

very powerful but use c processor.






5.Pixel raycasting engine (source available)










7. Strille’s ray caster(flash5)(source available)


http://www.strille.net/works/raycasting.swf (source available at flashkit)




8.Frédéric Heintz, aka FredH’s flash maze(source available)


Find the flash8 source at http://www.fredheintz.com


This one also has a simple editor.





9. doomedonline(source available)







10. Ryan A. Chilton’s Flash doom & quake(source available)






11.Another simple as3 raycaster







13.ericlin’s 3d maze(source available)





This one is not ray casting. It skews movieclips to create a perspective wall effect which is similar to raycasting.

====================

TUTORIALS

1. F. Permadi’s Ray-Casting Tutorial




2. Lode's Computer Graphics Tutorial-Raycasting (c++ source available)


3. Another Raycasting Engine Tutorial


4. Advanced raycasting techniques (Line based raycasting/Doom style, instead of cell based/Wolf style)


====================

LINKS


1. id Software’s Wolfenstein3D source code


2. A fast java raycaster like doom or wolfenstein 3D (source available)




3. Wolfenstein 3D in 20 lines of JavaScript by Mathieu 'p01' Henri (source available)http://www.p01.org/releases/20_lines_Castle_Wolfenstein/




4. JavaScript ray caster by Ben Joffe(source available)

http://www.benjoffe.com/code/demos/canvascape/textures

5.Flash AS3 Ray Casting Tutorial with example and source

http://www.rustyarcade.com/blog/read/33/Ray-Casting-Tutorial

6. UPDATE(2013-11-3)
Bresenham magic: raycasting, line of sight, pathfinding:
http://deepnight.net/bresenham-magic-raycasting-line-of-sight-pathfinding/

=============================================

UPDATE(2009-12-4)


rayfaster 2 test:
http://www.badsectoracula.com/peponi/rayfaster2/

Sponsors