Re: Simple LOVE Raytracer Code (both untextured and textured
Posted: Wed Dec 19, 2012 5:09 am
Thanks for the stats, and for checking it out! Yeah, I think the untextured version is faster because of "drawline"'s relative inefficiency, though I'm not sure. It seems strange that drawing a line would be less efficient than a textured quad though...substitute541 wrote:Here's my FPS
Nontextured
1. 640x480 : 79
2. 800x600 : 60
3. 1024x768 : 56
4. 1280x1024 : 45
Textured
1. 640x480 : 85
2. 800x600 : 72
3. 1024x768 : 58
4. 1280x1024 : 47
Strange, Textured is faster.. Here are my specs :
1280x1024 Monitor
No Graphics Card (derp)
Windows 7 Ultimate x64
(from memory) ASUS P5KPL-AM-SE Motherboard
Thanks for the encouraging words!coffee wrote:Congratulations. Your raytracer should be probably the lightest engine of this kind in LOVE (Inny's one is also quite light).
It's hard to ran one without heat up my machine but your hardware fingerprint is almost null. Also solid vsynced 60fps in both versions.
Plus your code is so clean (and short) that even a math idiot like myself could learn it easily. Well done.
Don't worry about the stretch bug some quad/math LOVE wizard will certainly help you to solve it.
I'm glad that my code is readable. That's something I always strive for as it was driven pretty hard into my heard when I first learned BASIC
Thanks! I'm really glad it proved helpful for you. I'd love for you to message me a link to an example of your lighting, if you don't mind sharing itGravy wrote:Very nice! It makes much more sense to increment the X distance and the Y distance in the same loop rather than do all the X's and all the Y's separately, as in the earlier raycasting demos that Jasoco and others posted a while back. I've been using raycasting for the lighting in my game, and this should make it a bit quicker.
Thanks for checking this outJasoco wrote:The more raycasters the better. Let everyone create their own. I love it. Imagine if Ken Silverman decided not to create the Build engine because DOOM was just so awesome. We wouldn't have the superior (To the DOOM engine) Duke Nukem 3D/Blood/Shadow Warrior engine which was capable of things the DOOM engine could never do, and even Quake couldn't do in some ways.
Ken started by creating a Wolfenstein 3D style engine of his own when he was a teenager. Then graduated to the more DOOM-like Build engine later on. YouTube has a lot of really cool videos documenting the history of his engines.
http://www.youtube.com/watch?v=l8tDBg4pfYk
My engine eventually gained floor textures (Aided by Canvas) as well as buggy doors, annoying dumb NPC's that just constantly walk towards you, a map and sprite objects. When I get around to redoing it, it will get even more... eventually. At some point eventually.
Ah, I'm a big Ken Silverman fan, and of the Build engine. While I prefer Doom and its engine's aesthetic over the Build engine's (Doom based games just had a certain feel to them that I love), a lot of aspects of the Build engine were pretty genius.
Reading Ken's website a while back got me interested in a voxel engine. Perhaps I'll attempt something like that in LOVE, though that's probably a little over my head Oh, and speaking of which, anyone interested in Ken's work can get a lot of free downloads from his website (including his voxel engine(s), the Build engine source code [including updates to it and its tools as recent as 2009], and the aforementioned Wolf3D clone "Ken's Labyrinth"): http://advsys.net/ken/ There's a lot of great info there for people interested in this great and revolutionary era of computer games!
I'm interested in the canvas method of casting floors, though it does seem pretty limited. I experimented with the pixel-by-pixel approach to floor casting from Lode's tutorials, but in LOVE it ended up being a buggy mess that absolutely destroyed the framerate...
PS: I love the music on that video...relaxing in an AFX/Analord sort of way.
Thanks for looking!Inny wrote:Very neat.
In addition to Lode's tutorial, you probably saw this in your searches as well: http://www.permadi.com/tutorial/raycast/index.html
There's a few good tidbits of info in there, like how to get looking up/down and changing the eyeline (to simulate jumping/ducking). In terms of how it applies to Lode's code, the center line you draw the scanlines from is for "Looking", meaning change that and you can look up and down. The eyeline was a bit more tricky. I have updated code that I probably should refresh my old thread with to demonstrate these features. I was taking my engine towards being an RPG engine though, and gave up when it came to floor/ceiling textures since I couldn't find a reasonable way to do it (even the mode7 style code looked to be way too painful toward the framerate).
What I'd also love to see eventually done is variable height floors/ceilings. Even if we can't quite get to textured surfaces, it'd be nice to see doom/hexen or even RiseoftheTriad style vertical movement. It might make a nice longterm goal for you if you want to take your code past the wolfenstein era.
Yeah, I had seen the Permadi article too. There is a lot of good info there, though I hadn't really dug in enough to translate it to my current code. If I decide to further this little engine, what you wrote will definitely be helpful!
I don't think that RotT stlye movement would be that hard, but anything in the vein of the Doom engine would be quite a leap. I think we'd have to follow a similar line that id Software did and use a BSP-style system. Speaking of which, I think it might be worthwhile using lookup tables for the different formulas like almost all of these old engines (like the Wolf3D engine, the DOOM engine, and IIRC the Quake 1 engine did). I'm not really sure how to go about this though :/
I've yet to look at the Wolf3D or DOOM source code yet, though I've wanted to. Knowing the era and Carmack, there's probably enough Assembly to make my head spin...Jasoco wrote:DOOM would be very possible. Except that floor/ceiling would be very hard as far as I've seen so far. (I had to resort to canvases for floors in my Wolf clone and that's just one plane) Also you'd need to figure out collision with arbitrarily positioned lines.
I did do a lot of research into the histories of DOOM and Wolfenstein back then.
The source code for each is readily available even though it's C.
Like I mentioned before, you can also grab the Build engine source code from Ken's site ( http://advsys.net/ken/buildsrc/default.htm ). There's also JonoF's port/fork which ports the Build engine from DOS to Windows, MacOSX, and Linux, while also adding some enhancements like a full 3D renderer and 3D model support: http://www.jonof.id.au/jfbuild (though the original engine is probably more relevant to what we would want to/could do with LOVE). You can also get the source code to "Ken's Labyrinth": http://advsys.net/ken/klab.htm
Agreed! I don't think that this would be THAT hard, but then again I'm still having trouble with a lot of the basicsInny wrote:RoTT seems like the next logical step, seeing as how it was just the floor on a flat plane, and they emulated staircases and platforms heights through sprites.
See: https://love2d.org/imgmirrur/uTlGG.jpg
Yes!Gravy wrote:Jasoco, I remember all the awesome screens you posted of your double-layered raycasting with mouselook. We're still waiting for the final product