Simple LOVE Raytracer Code (both untextured and textured)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Jasoco
Inner party member
Posts: 3650
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by Jasoco » Wed Dec 26, 2012 6:41 am

Nope. I forgot to mention you should ignore the FPS. It was bad timing on my part of taking the screenshot.

And no, the jaggedness is going to show up no matter what because floors/ceilings in my engine are done by placing a big floor sized canvas inside a big container canvas rotated and positioned in the right place then breaking into quads, figuring out every location and distance of each floor "ray" and then displaying them first before drawing the floors.

scutheotaku
Party member
Posts: 235
Joined: Sat Dec 15, 2012 6:54 am

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by scutheotaku » Wed Dec 26, 2012 6:49 am

Jasoco wrote:Nope. I forgot to mention you should ignore the FPS. It was bad timing on my part of taking the screenshot.

And no, the jaggedness is going to show up no matter what because floors/ceilings in my engine are done by placing a big floor sized canvas inside a big container canvas rotated and positioned in the right place then breaking into quads, figuring out every location and distance of each floor "ray" and then displaying them first before drawing the floors.
Ah, ok. Thanks!

User avatar
IndieKid
Citizen
Posts: 80
Joined: Sat Dec 22, 2012 7:05 pm
Contact:

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by IndieKid » Wed Dec 26, 2012 3:04 pm

Jasoco wrote: Well, skimming over that huge block of text above because it's a lot of text, I did it by using Canvases.

Image

Which would probably bum a lot of people out if you used. Also, it's not exactly the same graphically, but it works well enough no one would really care. But it used canvases.

But yes, it could all be completely solved if Löve could transform textured quads the way we require. A lot more 3D projects would probably crop up as a result even though Löve isn't meant for 3D. But dangit, we're ambitious little scoundrels.
Heh, ok. But I'm bad at Graphics in LOVE. Have you got .love file(or just source code, but love is better) of your game when there was a floor? It is the best way for me to learn.

User avatar
IndieKid
Citizen
Posts: 80
Joined: Sat Dec 22, 2012 7:05 pm
Contact:

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by IndieKid » Wed Dec 26, 2012 5:21 pm

scutheotaku wrote: I believe that the easiest way to do floors (aside: whenever I'm referring to floors, I'm usually also referring to ceilings since the idea would be almost the same) would be to just draw them as textured quads. The problem with that is a big one, at least as far as LOVE is concerned. As of yet, there just isn't a good way to transform quads like we'd need to. Ideally, we should be able to set the coordinates of each vertex of each quad, though this currently isn't possible. If it was...you'd need a way to figure out where you are on the floor (so that the texture doesn't move as you move), which would probably be the hardest part. The second hardest part would be figuring out what "angle" to draw the floor at...but that wouldn't be too hard. See here: http://www.permadi.com/tutorial/raycast/rayc11.html & here http://www.permadi.com/tutorial/raycast/rayc12.html for an idea behind the math.

...

Combine that knowledge with the explanation of UUW's tile system from the TSSHP link I gave, and that paint a picture of what I feel would be the best (as far as an optimal features:speed ratio) 2.5D engine currently possible with LOVE. At least, it seems like LOVE's speedy drawing of textured quads makes this method the most attractive. Assuming, of course, that we can actually transform quads in this way...I'll say, it seems extremely strange that this isn't a feature yet (though I realize that LOVE is still a WIP, so I'm not upset or anything). I hope that it is something that's added soon!
Thanks for helping me! I took some notices from this. But I don't have that much experience for even thinking of making engines like DOOM or Build. Also I like your idea of trying to make our games look like not old-school Wolfenstein 3D game, but like more advanced games. Here's what I'm trying to do right now: I'm making engine like Wolfenstein 3D but with more abilities. I've recorded a short demo of my current progress.



Tell me what you think about it.

User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by Ubermann » Fri Dec 28, 2012 3:28 pm

I modified the source to get a resolution of 1920x1080.

FPS were 24 with textured demo and around 16 or 17 with nontextured.

scutheotaku
Party member
Posts: 235
Joined: Sat Dec 15, 2012 6:54 am

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by scutheotaku » Sat Dec 29, 2012 5:23 am

IndieKid wrote:
scutheotaku wrote: I believe that the easiest way to do floors (aside: whenever I'm referring to floors, I'm usually also referring to ceilings since the idea would be almost the same) would be to just draw them as textured quads. The problem with that is a big one, at least as far as LOVE is concerned. As of yet, there just isn't a good way to transform quads like we'd need to. Ideally, we should be able to set the coordinates of each vertex of each quad, though this currently isn't possible. If it was...you'd need a way to figure out where you are on the floor (so that the texture doesn't move as you move), which would probably be the hardest part. The second hardest part would be figuring out what "angle" to draw the floor at...but that wouldn't be too hard. See here: http://www.permadi.com/tutorial/raycast/rayc11.html & here http://www.permadi.com/tutorial/raycast/rayc12.html for an idea behind the math.

...

Combine that knowledge with the explanation of UUW's tile system from the TSSHP link I gave, and that paint a picture of what I feel would be the best (as far as an optimal features:speed ratio) 2.5D engine currently possible with LOVE. At least, it seems like LOVE's speedy drawing of textured quads makes this method the most attractive. Assuming, of course, that we can actually transform quads in this way...I'll say, it seems extremely strange that this isn't a feature yet (though I realize that LOVE is still a WIP, so I'm not upset or anything). I hope that it is something that's added soon!
Thanks for helping me! I took some notices from this. But I don't have that much experience for even thinking of making engines like DOOM or Build. Also I like your idea of trying to make our games look like not old-school Wolfenstein 3D game, but like more advanced games. Here's what I'm trying to do right now: I'm making engine like Wolfenstein 3D but with more abilities. I've recorded a short demo of my current progress.



Tell me what you think about it.
That looks pretty cool! I like the mouselook, and the nightvision-type view too :D


---


As for me, I think I'll let this sit for now. If anyone has any code suggestions (particularly related to my mysterious, aforementioned table problem...), I'd be more than willing to look at and possibly add them; but for now I'm going to focus on actually making a game. And a 2D game at that. I do feel that, obviously, 2D is what LOVE is best at (particularly while our control over quads is so limited, and/or while polygons can't be textured). Though if we get textured polygons or vertex control of quads, I'll be very, very interested in going at this again in a similar style to how Notch did Prelude of the Chambered.

I'll still be curious to see anyone else's advancements with this though!

User avatar
IndieKid
Citizen
Posts: 80
Joined: Sat Dec 22, 2012 7:05 pm
Contact:

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by IndieKid » Sun Dec 30, 2012 3:07 pm

Thanks. That's all I made for now. I failed to add objects and floor^^ Have you got any ideas on how to add objects?

scutheotaku
Party member
Posts: 235
Joined: Sat Dec 15, 2012 6:54 am

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by scutheotaku » Mon Dec 31, 2012 3:45 am

IndieKid wrote:Thanks. That's all I made for now. I failed to add objects and floor^^ Have you got any ideas on how to add objects?
I'm implementing that into my engine, though I'm having some trouble because of (what is probably) an unknown error in my code. To read how I'm going about this, read the second half of my post here (after the "EDIT:" line):
viewtopic.php?f=5&t=12069&start=10#p72453

Once I get the table to sort properly (I still don't get what's going on there...I must be missing something!) so that clipping is handled, I'll just have to draw the sprites in the 3D space. This is relatively easy, actually. Jasoco's post here describes how to do this: viewtopic.php?f=5&t=12069&start=10#p72457

User avatar
IndieKid
Citizen
Posts: 80
Joined: Sat Dec 22, 2012 7:05 pm
Contact:

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by IndieKid » Mon Dec 31, 2012 7:06 pm

scutheotaku wrote:
IndieKid wrote:Thanks. That's all I made for now. I failed to add objects and floor^^ Have you got any ideas on how to add objects?
I'm implementing that into my engine, though I'm having some trouble because of (what is probably) an unknown error in my code. To read how I'm going about this, read the second half of my post here (after the "EDIT:" line):
viewtopic.php?f=5&t=12069&start=10#p72453

Once I get the table to sort properly (I still don't get what's going on there...I must be missing something!) so that clipping is handled, I'll just have to draw the sprites in the 3D space. This is relatively easy, actually. Jasoco's post here describes how to do this: viewtopic.php?f=5&t=12069&start=10#p72457
I used your code as the source for engine, I'm going to rewrite it and then I'll be able to say what was wrong. I like how it is described in HTML5 tutorial.

User avatar
jordan4ibanez
Prole
Posts: 18
Joined: Sun Dec 30, 2012 7:22 pm

Re: Simple LOVE Raytracer Code (both untextured and textured

Post by jordan4ibanez » Sun Jan 06, 2013 7:44 pm

Wow that's actually really cool! I modified it a little bit to give it a more traditional feel:
-Pitch (Up/Down) Is limited
-It uses WASD instead
-You use the mouse to look around
-There's a sensitivity for mouse x/y axis

That's really brilliant btw :) I get 60 fps solid with textured mode
Attachments
doomer.love
The modification
(32.86 KiB) Downloaded 142 times

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 14 guests