Textured Raycaster [Multiple Levels! Door Covers! Jumping!]

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Textured Raycaster [Multiple Levels! Door Covers! Jumping!]

Post by Davidobot »

Before anyone says anything, I know this has been done a million times, but here is my take on raycasters.
This is, without doubt, the pinnacle of my development over the years of using the LOVE engine.

Features:
- Textured Walls (As of v1)
- Textured Floor/Ceiling (Re-redone as of v6) [Thanks for all the help, Jasoco!]

- Sprites (As of v2)
- Rotating Sprites (As of v6)

- Distance Fog (As of v2)
- Jumping and Crouching (As of v6)
- Looking Up and Down (As of v6)

- Support for multiple levels (up to 3, as of v6)
- Support for "door covers" (As of v6) [The wall above the door]
- Textured Doors (As of v4) [Thanks, Jasoco! But I did these a bit differently from you] [Uses xXxMoNkEyMaNxXx's amazing shader]
- Transparent Blocks (As of v4)

Controls:
Use WASD to move
Mouse to turn
Bump into doors to open them
Left Shift to crouch
Space to jump

Screenshots:
Image
Image
Image

Original based on this tutorial: http://lodev.org/cgtutor/raycasting.html
Sprites:
http://opengameart.org/content/roguelik ... orld-tiles
http://opengameart.org/content/roguelikerpg-items
Attachments
raycaster0.10.0.love
v6.1 Latest Version
(345.87 KiB) Downloaded 2329 times
raycaster_latest.love
v6 Canvas + Shaders
(427.27 KiB) Downloaded 2128 times
game.love
v4.5 Canvas + Shaders
(227.18 KiB) Downloaded 1904 times
Last edited by Davidobot on Tue Mar 28, 2017 6:38 pm, edited 8 times in total.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Textured Raycaster

Post by jjmafiae »

Better than wolfenstein3D.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco »

Textured walls are super easy. It's textured floors that are the challenging part.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post by Davidobot »

Jasoco wrote:Textured walls are super easy. It's textured floors that are the challenging part.
I'll try to add that tomorrow, together with sprites.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Textured Raycaster

Post by dusoft »

Davidobot wrote:
Jasoco wrote:Textured walls are super easy. It's textured floors that are the challenging part.
I'll try to add that tomorrow, together with sprites.
Nice work! I'll be glad to see more.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post by Davidobot »

Jasoco wrote:Textured walls are super easy. It's textured floors that are the challenging part.
Ok, I kinda got it to work, expect, as you can see, the FPS is terrible. I need to figure out how you calculated the angles in order to quickly draw the floor in your Raycasting demo, Jasoco.
Image

EDIT: Would you be able to distort images into a non-parallelogram shape using shaders?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco »

Davidobot wrote:
Jasoco wrote:Textured walls are super easy. It's textured floors that are the challenging part.
Ok, I kinda got it to work, expect, as you can see, the FPS is terrible. I need to figure out how you calculated the angles in order to quickly draw the floor in your Raycasting demo, Jasoco.
Image
For my Raycaster I used canvases. Two big ones to be exact. One for drawing the other onto. I would draw the floor canvas onto the second canvas at the position offset and rotation that the player camera was at, the container canvas was divided into horizontal 1 pixel tall quads, then would use some math raycasting calculations to figure out which floor strips to draw on the floor.

It looked janky when rotated though. But it worked. However...
Davidobot wrote:EDIT: Would you be able to distort images into a non-parallelogram shape using shaders?
Yes. I didn't in my Raycaster, but you can definitely do it.

As long as you only want one texture for the floor. My method above allowed me to have whatever I want on the floor. Including other tile textures. I had also planned on using the method to draw footsteps or blood splatters or other things for extra detail.

Either way, a properly written shader could definitely do it. Don't ask me how to code that shader though. lol

Once you conquer the floors, your next challenge is DOORS! Muahahahaha!!!! *cough*

Sprites are nothing. Especially if you coded the wall drawing correctly. But will be a challenge if you didn't code them properly. Good luck!!!!

Note: I have posted my Raycaster code on this forum numerous times. Try searching for a post from me that mentions raycasting or wolfenstein and see if it's still available somewhere. It might help.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post by Davidobot »

Jasoco wrote: As long as you only want one texture for the floor. My method above allowed me to have whatever I want on the floor. Including other tile textures. I had also planned on using the method to draw footsteps or blood splatters or other things for extra detail.

Either way, a properly written shader could definitely do it. Don't ask me how to code that shader though. lol
Hm, I'll need to try your method.
Jasoco wrote: Once you conquer the floors, your next challenge is DOORS! Muahahahaha!!!! *cough*
Yes. Yes. Hm :monocle:
Jasoco wrote: Sprites are nothing. Especially if you coded the wall drawing correctly. But will be a challenge if you didn't code them properly. Good luck!!!!
Yup! The sprites were no problem at all.
Jasoco wrote: Note: I have posted my Raycaster code on this forum numerous times. Try searching for a post from me that mentions raycasting or wolfenstein and see if it's still available somewhere. It might help.
I did, but I'm too lazy to change all of your code to 0.9.0 :P
So much getModes and modes and pixelEffects!
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco »

Davidobot wrote:
Jasoco wrote: Note: I have posted my Raycaster code on this forum numerous times. Try searching for a post from me that mentions raycasting or wolfenstein and see if it's still available somewhere. It might help.
I did, but I'm too lazy to change all of your code to 0.9.0 :P
So much getModes and modes and pixelEffects!
I don't think my version has an getMode or pixel effects in it. :huh:
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post by Davidobot »

Jasoco wrote:
Davidobot wrote:
Jasoco wrote: Note: I have posted my Raycaster code on this forum numerous times. Try searching for a post from me that mentions raycasting or wolfenstein and see if it's still available somewhere. It might help.
I did, but I'm too lazy to change all of your code to 0.9.0 :P
So much getModes and modes and pixelEffects!
I don't think my version has an getMode or pixel effects in it. :huh:
Hhm? Yeah, it had like a choice of resolutions and stuff.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Post Reply

Who is online

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