Page 2 of 8
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Tue Feb 23, 2010 7:34 am
by pekka
I found the code became a little cleaner when I change the rectangle drawing to line drawing. Setting the line width appropriately is necessary. It doesn't make it much faster, though, but I think it made it a little faster for me.
Without measuring anything, I suspect the most time is spent raycasting. It looks like the FPS drops when are in a position where you can see many walls farther away.
I want to see the DOOMish engine. Which thread is it in?
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Tue Feb 23, 2010 9:19 am
by Thursdaybloom
I think he means this link:
http://www.javascriptgaming.com/2009/02/canvex.html
From this post:
http://love2d.org/forum/viewtopic.php?p=12931#p12931
I also found this while looking further into Raycasting (I'd love to be able to do it but I'm such a n00b)
http://www.permadi.com/tutorial/raycast/index.html
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Tue Feb 23, 2010 12:32 pm
by pygy
Now with walls in colors :-)
Using this code as a drop-in replacement for the old color objects (except that you must call the resulting color object where you want to use it).
Code: Select all
do
local globalAlpha = 255
local _rgba
setAlpha=function(alpha) globalAlpha = alpha end
local translateRGBA={
[1]=function(i) return _rgba( i, i, i ) end,
[2]=function(i,a) return _rgba( i, i, i, a ) end,
[3]=function(r,g,b) return _rgba( r, g, b ) end,
[4]=function(r,g,b,a) return _rgba( r, g, b, a ) end
}
setmetatable(translateRGBA,{__index=function(t,i) error("Color: rgba() accepts 1 to 4 parameters") end})
_rgba = function(...)
local r, g, b, a = ...
return function(alpha)
if alpha then
return r, g, b, alpha
elseif a then
return r, g, b, a
else
return r, g, b, globalAlpha
end
end
end
function rgba(...)
return translateRGBA[#{...}](...) -- the use of #{...} is intentional.
end
end
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Tue Feb 23, 2010 2:49 pm
by TechnoCat
Adjusted height and width of lines.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Tue Feb 23, 2010 3:11 pm
by Robin
Yet another variant: some basic optimizations (doesn't seem to affect framerate though), plus Home and End can now be used to ajust raytracing quality.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Thu Feb 25, 2010 2:47 am
by Jasoco
We gotta figure this out! I mean, THIS was possible in the 80's on a classic Macintosh (Or DOS computer) with very little slowdown. I would hope the same could be achieved on a computer thousands of times faster...
http://www.youtube.com/watch?v=i1XENlUUOhA
It used a square grid-based map system like Wolfenstein did, but instead of textures it used solid colored squares with line decorations on them. IMHO, it looked really cool for its time. And this was years before Wolfenstein even came out.
You know the actual Wolfenstein code is available on the internet for free from id Software. Maybe it could help? (The real DOOM code is there too.)
Keep going! I want something to come of this!
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Thu Feb 25, 2010 3:32 pm
by snake
There are some nice playable raytracing games for the PSP which run with LUAplayer.
So if the PSP can do it i wonder why Love has problems with it.
I will look at the source at these and maybe port one to love.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Thu Feb 25, 2010 4:04 pm
by bartbes
The easiest way to improve the FPS by a lot is by disabling the FPS draw and I guess there are some other (similar) tweaks to be done.
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Thu Feb 25, 2010 5:03 pm
by Virox
bartbes wrote:The easiest way to improve the FPS by a lot is by disabling the FPS draw and I guess there are some other (similar) tweaks to be done.
What do you mean by "disabling the FPS draw"?
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
Posted: Thu Feb 25, 2010 5:08 pm
by kikito
I think he means that
the only winning move is not to play.
Typical machine-logic assesment.