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: 1140
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

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

Post by Davidobot » Tue Aug 19, 2014 5:02 pm

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 411 times
raycaster_latest.love
v6 Canvas + Shaders
(427.27 KiB) Downloaded 591 times
game.love
v4.5 Canvas + Shaders
(227.18 KiB) Downloaded 512 times
Last edited by Davidobot on Tue Mar 28, 2017 6:38 pm, edited 8 times in total.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

jjmafiae
Party member
Posts: 1333
Joined: Tue Jul 24, 2012 8:22 am

Re: Textured Raycaster

Post by jjmafiae » Tue Aug 19, 2014 5:47 pm

Better than wolfenstein3D.
My Itch.io Games (Not up to date)
My Website

User avatar
Jasoco
Inner party member
Posts: 3615
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco » Tue Aug 19, 2014 6:07 pm

Textured walls are super easy. It's textured floors that are the challenging part.

User avatar
Davidobot
Party member
Posts: 1140
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

Re: Textured Raycaster

Post by Davidobot » Tue Aug 19, 2014 6:20 pm

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.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

dusoft
Citizen
Posts: 66
Joined: Fri Nov 08, 2013 12:07 am

Re: Textured Raycaster

Post by dusoft » Tue Aug 19, 2014 9:32 pm

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: 1140
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

Re: Textured Raycaster

Post by Davidobot » Wed Aug 20, 2014 8:06 am

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?
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

User avatar
Jasoco
Inner party member
Posts: 3615
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco » Wed Aug 20, 2014 5:46 pm

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: 1140
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

Re: Textured Raycaster

Post by Davidobot » Wed Aug 20, 2014 5:53 pm

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!
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

User avatar
Jasoco
Inner party member
Posts: 3615
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post by Jasoco » Wed Aug 20, 2014 5:56 pm

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: 1140
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

Re: Textured Raycaster

Post by Davidobot » Wed Aug 20, 2014 6:07 pm

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.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests