AS3 Raycaster
November 2nd, 2005
A fast implementation of a raycaster. You can move forward by pressing the mouse button. This version also provides a camera roll and height, ceil and floor tiles. To boost up the code, I'm using a lookup table for sin, cos, tan and massive bitshifting. The code is accordingly unreadable. What I'm really missing is a typed Array with simple bytes to write faster code, just reading RGB values. I have the feeling, that the getPixel method is too slow. This causes the small stage (240x160px).
as3 raycaster flashplayer 8.5 needed
[leaving the map causes missing walls]
Filed under: actionscript
22 Responses to “AS3 Raycaster”
-
Jon B Says:
November 2nd, 2005 at 8:35 pmawesome
-
blog.je2050.de Says:
November 2nd, 2005 at 8:58 pm[...] led under:misc — joa @ 9:58 pm
André Michelle released not just a very fast raycaster today but also made a very interesting post on the Flashforum. It is [...]
-
icio Says:
November 2nd, 2005 at 9:06 pmAbsolutely awesome, Andre.
Great work :) -
Paul Neave Says:
November 2nd, 2005 at 11:01 pmWow, that really is very cool (even considering the limitations).
-
Jensa Says:
November 3rd, 2005 at 10:19 pmBrilliant stuff! When I ran the SWF directly as fullscreen 1024×768, I still had more than 30 fps!
J
-
bitwize Says:
November 4th, 2005 at 3:35 pmBrilliant work Andre.
“What I’m really missing is a typed Array with simple bytes to write faster code, just reading RGB values. I have the feeling, that the getPixel method is too slow.”
hmm. if i’m understanding correctly, does this help?
BitmapData.getPixels()
“No, longer do you have to loop through every pixel in a bitmap, one at a time with getPixel… This method returns a ByteArray containing the hexadecimal color value of each of the pixels in the specified rectangular region of a bitmap.”
(source: http://www.flashguru.co.uk/actionscript-3-new-capabilities/ )
-
André Michelle Says:
November 4th, 2005 at 3:42 pm@bitwize:
Unfortunatley reading ByteArrays is much slower than reading from an Array.
What I mean is an Array, where all entries are typed to ‘int’. In Java, most grafic application read the pixels and stores them to a char[] Array. It is very fast to read an entry from.
-
kiroukou Says:
November 4th, 2005 at 6:06 pmImpressive Andre !!
Is bitshifting really faster in AS3 because in AS2 there’s no real difference :SAbout your types Array, did you think about creating a List? I mean it cans be compute like a structure owning a reference to the next node and a int value.
Don’t think it can be faster, but you can give it a try ;)
++ -
mh Says:
November 4th, 2005 at 11:46 pmandre you should write a book about all this, im sure it would sell, and its the only way the rest of us have a chance of catching up.
-
Ralph Hauwert Says:
November 7th, 2005 at 5:35 pmVery impressive andre. Think you could speed up the whole thing alot more by adding fog maybe ?
-
franto Says:
November 8th, 2005 at 9:26 amawesome!
-
nTeract » The Official Last MAX Post Says:
November 11th, 2005 at 3:44 am[...] ;s amazing what people have done already… from Fourier waveform analysis of audio to realtime 3d raycasting – the capabilities of the new language and player are just now beginnin [...]
-
Franto.com Flash blog » Collected links to ActionScript 3.0 examples Says:
November 14th, 2005 at 9:20 am[...] Max file and render it) AS3 Pixelbased raycasting engine AS3 vector 3D class (source code) AS3 Raycaster Andre Michelle ActionScript 3.0 Sound >> 5 sites Sound Spe [...]
-
Arul Prasad Says:
February 1st, 2006 at 5:08 pmBhooo :-(
This doesnt work with the latest alpha release of Flash Player 8.5!!
Somethings changed, you got to fix ur app!!
-
Andrew Says:
February 5th, 2006 at 3:09 amYeah im also having problems getting any thing to show up. Maybe there is an issue with the latest alpha release. Its to bad cuz i really want to see these AS3 demos :(
-
thopol Says:
February 14th, 2006 at 8:39 amstrange… i’ve installed flash player 8.5 for IE and FF as well and all I can see is cyan background, the same with other as3 demos.
-
Richard Says:
March 6th, 2007 at 1:12 amVery nice work. Thanks Andre.
-
Chris Says:
March 17th, 2007 at 11:32 amNOOOO!!! Why can’t I write a textured raycaster in Flash that runs more than 15 fps?! I might just kill myself Q_Q.
-
Nick Says:
June 23rd, 2008 at 8:56 pmErm, your link to the Raycaster is broken, pity as I’d love to see it.
See http://www.visualharmonics.co.uk for a grand compilation of AS2/3 optimisation tips.
-
DeCabeza.net » Colección de link útiles sobre ActionScript 3 - desarrollo web, tutoriales, video tutoriales, videotutoriales, flash, photoshop, php, mysql, dreamweaver Says:
June 27th, 2008 at 4:34 pm[...] AS3 Raycaster Andre Michelle [...]
-
Jonathan Says:
November 10th, 2008 at 6:19 pmHi, i’m looking to write a ray caster that will work for 2d images, would you be able to let me know of any good resources out there, kind of overwhelmed with the extent of the information availble
-
PittMFUG » Blog Archive » January 2006 Meeting Redux Says:
July 26th, 2009 at 10:25 pm[...] Freestyle LinksPerspective DistortionAdidas KG3iMac Intel Mac Boot vs. iMac G5 VideoFlash 8: How to Colorize Ãla PhotoshopAsk A NinjaBit 101 Lab FLAs OnlineLightweight Scrollbar ComponentAS3 Raycasting [...]
