Raycasting in Flash 8

Using what’s he’s calling the Flash Ray Engine, Glen Rhodes ported a version of id Software’s game Wolfenstein 3d to Flash 8. It’s working pretty nice, and is a great glimpse of what’s ahead on the future of Flash 8 games. Raycasting engines had been ported before to Flash 7, but they were too slow; I have also seen a previous Flash 8 raycasting engine by someone else, but it managed to be slower than the Flash 7 ones. This one, on the other hand, is pretty quick and feels like a direct port of the game.

Source: beedigital

  • I think the other engine you saw was http://www.digital-ist-besser.de/tryouts/raycasting_pixelbased/
    He links to Lode’s raycasting tutorials at http://www.student.kuleuven.ac.be/~m0216922/CG/index.html, which is in fact also the C source code that Glen based his ‘Flash Ray Engine’ on.
    digital-ist-besser’s version includes floor/ceiling rendering, which is turned off in glen’s version (although the code is all there).
    Lode’s tutorials are excellent, and it looks like both of these examples greatly benefit from them.
    Glen is cleverly using 1 pixel wide strips of each texture to do the drawing (Eric Lin discusses a similiar, pre flash 8 method, see example 32 “compare the methods for perspective skew bitmap” at http://www.geocities.com/~dr_ericlin/flash/indexgeo.html ). In flash 8 Glen is able to cache each wall texture tile to 64 1 pixel wide bitmap stripes . Using Lode’s raycasting code only 1 of these stripes needs to be drawn to the screen bitmap buffer for each screen X coord (scaling vertically and adjusting light in the process) (Lode’s raycasting code is doing things the C way, setting each pixel value, too slow for flash)
    Both of these raycasting engines give glimpses into what will be possible with flash 8.

  • zeh

    Tim, you’re absolutelly right. That was the link I saw. I also saw another one – I believe both of them were from some FlashKit forum thread – but they were very similar in technique and speed.

    Thanks for the additional info too. Much appreciated. I’ve worked with raycasting once – creating a text-based ‘3d’ engine in QuickBasic with ANSi textures! – and I hope I’ll be soon doing my own experiments on Flash 8 too. 🙂

  • I also made a raycast engine. Is not perfect, but is my first try! i’m currently making a 2nd version, with textures, in Java, and i hope, with sprites… if my brain is good to me… lol.

    My raycast: http://www.bandinopla.com.ar/raycasting3.swf Is sloww, bicouse I plot every pixel.