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

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

### Re: Textured Raycaster

Rukiri wrote:whenever I run into a wall I seem to get this error.
Error

Traceback
[c]: in function 'draw'
floor.lua.54: in function 'drawfloor'
main.lua.92: in function 'draw'
[c]: in function 'xpcall'
I finally got around to fixing this, plus added ceilings.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

### Re: Textured Raycaster

There are two tricks you can use with raycasters of this type to give the illusion of height and Z-looking.

The Z-Looking is easy, the middle row vertically, or the vanishing point, you change which line on the screen that is. Or, if you calculate the top line of the wall texture as being half the screen minus half the projected size of the strip, that "half of the screen" is the variable for looking up and down.

The Z-Height is a bit more difficult, but it's also part of calculating the top of the wall. "Height" gets divided by distance to the wall and then added to where the Z-Looking line is. Walls closer get drawn proportionally lower or higher than the further walls are.

So, for a bit of math here from my own raycaster (zHeight and zLook are the two variables):

Code: Select all

    local fovratio = 1.0 / (math.pi/2)
local vheight = 180
local eyeLine = ((walls.size*0.5) - zHeight) * fovratio
local topOfWall = (zLook + floor(vheight * 0.5)) - (size*0.5) - (eyeLine/dist)

Not sure how that'll affect drawing floors and ceiling.

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

### Re: Textured Raycaster [Now with Doors!]

Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
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 [Now with Doors!]

Davidobot wrote:Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
My mind is blown ;_; can you fix it? xD
My Itch.io Games (Not up to date)
My Website

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

### Re: Textured Raycaster [Now with Doors!]

jjmafiae wrote:
Davidobot wrote:Massive update! Now has doors and other cool shiz!
It's basically complete at this stage, way more advanced that Wolf3D.
My mind is blown ;_; can you fix it? xD
*patpat* It's okay, I just redid the floors so everything should be okay.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

### Re: Textured Raycaster [Now with Doors!]

Broke your game with forward movement towards a corner.

I assume I am not intended to be able to be at my current coordinates
http://imgur.com/q4RLXFz

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

### Re: Textured Raycaster [Now with Doors!]

whitebear wrote:Broke your game with forward movement towards a corner.

I assume I am not intended to be able to be at my current coordinates
http://imgur.com/q4RLXFz
Were you not able to move?
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

### Re: Textured Raycaster [Now with Doors!]

Nah, could bug my self out same way I came.
I think the issue is with movement diagonally into space where there is room to move to. even if two walls should "block" you.

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

### Re: Textured Raycaster [Now with Doors!]

I decided to release the v6 of this raycaster to the public (v5 was not released).
This version has been floating around the forum for a while and I thought it was time to release it. Maybe someone will find it useful.
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

### Re: Textured Raycaster [Multiple Levels! Door Covers! Jumpin

Wow, this is cool

### Who is online

Users browsing this forum: No registered users and 5 guests