AS3 Raycaster

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).

Update 2010
The files are missing for some reason. However the Raycaster is still here even though it is very old now.

23 thoughts on “AS3 Raycaster”

  1. Pingback: blog.je2050.de
  2. Brilliant 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/ )

  3. @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.

  4. Impressive Andre !!
    Is bitshifting really faster in AS3 because in AS2 there’s no real difference :S

    About 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 ;)
    ++

  5. andre 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.

  6. Yeah 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 :(

  7. strange… 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.

  8. Hi, 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

  9. Someone necessarily lend a hand to make severely articles I might state. That is the very first time I frequented your website page and so far? I amazed with the research you made to make this particular put up amazing. Fantastic activity!

Comments are closed.