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?
Raycasting Demo (like Wolfenstein3D, just veery basic)
- Thursdaybloom
- Citizen
- Posts: 81
- Joined: Mon Feb 15, 2010 3:43 am
- Location: Australia
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
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
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)
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).
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
- Attachments
-
- raycast.love
- v0.6.1b
- (2.85 KiB) Downloaded 147 times
Last edited by pygy on Sun Feb 28, 2010 10:02 pm, edited 1 time 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.
- 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)
Adjusted height and width of lines.
- Attachments
-
- raycast.love
- 0.6.1
- (2.8 KiB) Downloaded 120 times
Last edited by TechnoCat on Tue Feb 23, 2010 6:03 pm, edited 1 time in total.
- 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)
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.
- Attachments
-
- raycast.love
- (2.78 KiB) Downloaded 122 times
Help us help you: attach a .love.
- 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)
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!
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)
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.
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.
- 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)
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)
What do you mean by "disabling the FPS draw"?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.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Raycasting Demo (like Wolfenstein3D, just veery basic)
When I write def I mean function.
Who is online
Users browsing this forum: Semrush [Bot], SiENcE and 0 guests