I've been interested in learning how to make a basic raytracer-based 2.5D renderer for a while now, and, after being impressed by both LOVE's speed and Jasoco's work with his WolfenLOVE 3D engine, I decided to give it a try. So, I found Lode Vandevenne's excellent raycasting tutorials ( http://lodev.org/cgtutor/ ) and got started. And, after a night and a morning, here are the results...

It's nothing spectacular, but it might be a good start for someone looking into making a 2.5D game like Wolfenstein 3D or Blake Stone.
(prepare for a verbose description - scroll to bottom of post for downloads

I was able to mostly port the code from the untextured raycaster in Lode's first tutorial (which is in C++) to Lua/LOVE. There were obviously changes to get things working in Lua, and quite a few changes to the drawing to get it to work within LOVE's callback function (unfortunately resulting in a second For loop, though I don't imagine that it's affecting framerate too much).
For the textured version, I did make a fair amount of changes. First of all, instead of scanning each pixel individually, I, inspired by WolfenLOVE, used quads instead. This means that the program only has to do one check for each x position instead of one for each x/y combination (so, for a 640x480 window, it only has to do 640 checks per frame instead of 307,200 - actually 1280 per frame vs 614,400 per frame because of the drawing). It's a very simple way to boost the speed, but I probably wouldn't have thought of doing it that way without Jasoco's posts (if you're reading this, thanks!).
There is a problem with the textured version though...there's some distortion whenever you get very close to a wall (it seems to start once the height of a wall fills the entire height of the screen). I'm positive that this has something to do with my approach to using quads, but I haven't yet figured out a solution. If anyone does come up with something, I'd appreciate some tips

One thing to keep in mind: I purposely kept the structure of most of the code and the variable names as identical to those in Lode's tutorial as possible. This way, you (and I!) can directly use has excellent descriptions of how it works and what does what. Furthermore, one could use this as a base to continue with his raycasting tutorials and add things like sprites and textured ceilings and floors. You can find the tutorials here: http://lodev.org/cgtutor/ . I've also made an effort to clearly comment the code, so it should all be fairly easy to understand.
Here are the framerates I get for the textured version at different resolutions (obviously, the framerate is greatly affected by the resolution):
Resolution : Framerate
640 x 480 : 120 to 127 FPS
800 x 600 : 100 to 110 FPS
1024 x 768 : 86 to 95 FPS
1280 x 1024: 68 to 77 FPS
1280 x 960 : 67 to 75 FPS
I actually get a little slower framerate with the untextured version, though it's barely noticeable. I assume this has to do with the efficiency of LOVE's draw line function compared to the quads I use for the textured version. If the difference in framerate was bigger, I think I would probably try replacing the lines with quads in the untextured version.
I'd be curious to see what some of you get for a framerate. This computer has an Intel Core i5 3.2GHz processor in it, but only has Intel HD onboard graphics (though I don't think that the GFX card would make much of an impact since the math and loops are the main resource eaters here).
Also, both examples have some basic functions, including moving, turning, strafing, and support for multiple resolutions.
Ok, well, here are the downloads (I'm new to Lua and LOVE, so please exuse the code!):
Untextured: https://dl.dropbox.com/u/17269775/raytr ... g-1.0.love
Textured*: https://dl.dropbox.com/u/17269775/scuth ... d-0.6.love
*the textures are from the game Wolfenstein 3D and are copyrighted by id Software
Cheers,
Ben
PS: I realize that there are a few other threads on raycastering engines, but, since most of them having been posted in for a while, I figured I'd start a new thread.
EDIT:
I just came across Inny's port of Lode's tutorial code here: viewtopic.php?f=5&t=11770&p=70655&hilit ... ing#p70655
That will probably be a better reference or basic engine than mine as it 1. handles textures much better, and 2. has most of the features of the end-product of Lode's tutorial series.