The guy in that The Colony video?bartbes wrote:I certainly haven't, though I recently saw something about someone who calculated only one wall and used a trick to get all other walls from it.
Raycasting Demo (like Wolfenstein3D, just veery basic)
- TechnoCat
- Inner party member
- Posts: 1612
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Well, I recall him mentioning that the rooms in the warehouse were drawn by extending the wall up indefinitely. Don't know about calculating all walls.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Yes, he, he was talking about some nice tricks.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
I have tweaked the ray_cast function a bit, and cleaned up the draw routine (I draw the sky and the floor as big rectangles, then the walls as an overlay).
I get 60 fps almost all the time with a sliver width of 3. It's a bit slower (56-58 when the field is wide and deep). I have a Core Duo 2GHz (a 3.5 year old beast).
The current algorithm is still linear, but a better breed of linear.
It used to be fn( distance * 1/ray_resolution ) ) with ray_resolution = 0.02
it's now fn( ( distance * ( 1/seek_step ) + log2( (1/ray_resolution) * ( 1/distance) )) with
While typing this message, I thought of a way to make it faster and more accurate still. I'll post an update when I have the time.
We could implement fog by drawing a gradient on the floor and tweaking the wall colors as a function of distance.
Edit: new version with screen.vsync = false and love.load(dt) modified to move at the speed it had previously when hitting vsync.
Edit2: Love ignores the config file... weird.
Edit3: you can set VSync in main.lua if you want (love.graphics.setMode( config.width, config.height, false, true --[[set this to false]], 0 ))
Edit4: Now with screenshot. Notice the higher resolution and the FPS :-)
I get 60 fps almost all the time with a sliver width of 3. It's a bit slower (56-58 when the field is wide and deep). I have a Core Duo 2GHz (a 3.5 year old beast).
The current algorithm is still linear, but a better breed of linear.
It used to be fn( distance * 1/ray_resolution ) ) with ray_resolution = 0.02
it's now fn( ( distance * ( 1/seek_step ) + log2( (1/ray_resolution) * ( 1/distance) )) with
- seek_step = 0.1
- ray_resolution = 1/64
- a security to prevent distance from being < 1 in the calculation.
While typing this message, I thought of a way to make it faster and more accurate still. I'll post an update when I have the time.
We could implement fog by drawing a gradient on the floor and tweaking the wall colors as a function of distance.
Edit: new version with screen.vsync = false and love.load(dt) modified to move at the speed it had previously when hitting vsync.
Edit2: Love ignores the config file... weird.
Edit3: you can set VSync in main.lua if you want (love.graphics.setMode( config.width, config.height, false, true --[[set this to false]], 0 ))
Edit4: Now with screenshot. Notice the higher resolution and the FPS :-)
- Attachments
-
- raycast.love
- (3.18 KiB) Downloaded 143 times
Last edited by pygy on Sat Feb 27, 2010 3:09 pm, edited 7 times in total.
Hermaphroditism is not a crime. -- LSB Superstar
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
I think you forgot using deltatime when moving the camera, because I move very fast...
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
I didn't change anything to the load.update() logic. It still uses dt.
Edit: errr... well, actually, it takes a dt parameter, but it doesn't use it. I'll see what I can do :-)
Edit2: now it uses dt... and, yes, it's speedy :-)
Edit: errr... well, actually, it takes a dt parameter, but it doesn't use it. I'll see what I can do :-)
Edit2: now it uses dt... and, yes, it's speedy :-)
Last edited by pygy on Sat Feb 27, 2010 12:36 pm, edited 3 times in total.
Hermaphroditism is not a crime. -- LSB Superstar
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Woah.. good job, I'm hitting vsync!
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
I tried to disable vsync, but love ignores the config file (both love.conf and conf.lua).
Hermaphroditism is not a crime. -- LSB Superstar
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
You mean game.conf?pygy wrote:I tried to disable vsync, but love ignores the config file (both love.conf and conf.lua).
And LÖVE does not ignore conf.lua -- do you know the right syntax?
Help us help you: attach a .love.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
[snip] Edit... I read the wiki too fast...
But the problem was somewhere else:
love.graphics.setMode( 500, 400, false, true, 0 )
But the problem was somewhere else:
love.graphics.setMode( 500, 400, false, true, 0 )
Hermaphroditism is not a crime. -- LSB Superstar
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests