Page 1 of 8

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

Posted: Tue Aug 19, 2014 5:02 pm
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

Re: Textured Raycaster

Posted: Tue Aug 19, 2014 5:47 pm
by jjmafiae
Better than wolfenstein3D.

Re: Textured Raycaster

Posted: Tue Aug 19, 2014 6:07 pm
by Jasoco
Textured walls are super easy. It's textured floors that are the challenging part.

Re: Textured Raycaster

Posted: Tue Aug 19, 2014 6:20 pm
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.

Re: Textured Raycaster

Posted: Tue Aug 19, 2014 9:32 pm
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.

Re: Textured Raycaster

Posted: Wed Aug 20, 2014 8:06 am
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?

Re: Textured Raycaster

Posted: Wed Aug 20, 2014 5:46 pm
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.

Re: Textured Raycaster

Posted: Wed Aug 20, 2014 5:53 pm
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!

Re: Textured Raycaster

Posted: Wed Aug 20, 2014 5:56 pm
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:

Re: Textured Raycaster

Posted: Wed Aug 20, 2014 6:07 pm
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.