Page 2 of 8

Re: Textured Raycaster

Posted: Thu Aug 21, 2014 5:23 am
by Clouds
Perhaps I'm being naive, but:
- Won't the floor and ceiling always be "behind" walls? Can't you just draw it without any raycasting, like a background, and draw over it with the walls?
- Wouldn't a mesh object make short work of any necessary perspective (and maybe tiling, if co-ordinates beyond the image dimensions will repeat)?

Re: Textured Raycaster

Posted: Thu Aug 21, 2014 8:43 am
by Jasoco
Davidobot wrote:
Jasoco wrote:
Davidobot wrote: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.
Not to my recollection. My last Wolf engine was static screen size and used no pixel effects.

Re: Textured Raycaster

Posted: Thu Aug 21, 2014 8:46 am
by Wojak
You cat take a look at this (raycast5 version)
viewtopic.php?f=5&t=35876
I think this version has all the raycasting related stuff moved to a single file, so if You don't mind my chaotic coding it should be useful ;)

This version has vev graphical bugs here and there and of course the florcasting is based on Jasoco's

Re: Textured Raycaster

Posted: Thu Aug 21, 2014 10:02 am
by Davidobot
Clouds wrote:Perhaps I'm being naive, but:
- Won't the floor and ceiling always be "behind" walls? Can't you just draw it without any raycasting, like a background, and draw over it with the walls?
Well, they need to rotate with you.
Clouds wrote: - Wouldn't a mesh object make short work of any necessary perspective (and maybe tiling, if co-ordinates beyond the image dimensions will repeat)?
I have never dealt with mesh objects, so I don't know. But from my quick glance at the wiki page, I think it wouldn't work.
Jasoco wrote: Not to my recollection. My last Wolf engine was static screen size and used no pixel effects.
No clue. Maybe I'm using an old version?
Wojak wrote:You cat take a look at this (raycast5 version)
viewtopic.php?f=5&t=35876
I think this version has all the raycasting related stuff moved to a single file, so if You don't mind my chaotic coding it should be useful ;)

This version has vev graphical bugs here and there and of course the florcasting is based on Jasoco's
I used some examples from that topic actually.

EDIT: Fixed it! It works now <3 (With the exception of weird jittering)

Second EDIT: Updated main file.
jjmafiae wrote:Better than wolfenstein3D.
Now it is.

Re: Textured Raycaster

Posted: Fri Aug 22, 2014 11:50 am
by Wojak
Jasoco wrote: Either way, a properly written shader could definitely do it. Don't ask me how to code that shader though. lol
it took a while but here it is:
http://love2d.org/forums/viewtopic.php?p=172749#p172749
this proves that love blog has awesome tutorials ;)

Re: Textured Raycaster

Posted: Fri Aug 22, 2014 1:12 pm
by Davidobot
Wojak wrote:
Jasoco wrote: Either way, a properly written shader could definitely do it. Don't ask me how to code that shader though. lol
it took a while but here it is:
http://love2d.org/forums/viewtopic.php?p=172749#p172749
this proves that love blog has awesome tutorials ;)
Thanks! I'll try this out to to compare the different methods.

Re: Textured Raycaster

Posted: Sun Aug 24, 2014 7:26 am
by Rukiri
Wouldn't it be easier to pass arguments instead of hard coding the wood and red floor tiles?

Code: Select all

function drawInnerGround()
	love.graphics.setCanvas(groundInner)

	local on = false
	for x = 1, #map[1] do
		for y = 1, #map do
			love.graphics.setColor(255,255,255,255)

			if on then
				love.graphics.draw(img[6], x * 64, y * 64)
				on = not on
			else
				love.graphics.draw(img[7], x * 64, y * 64)
				on = not on
			end
		end
	end
	love.graphics.setCanvas()
end

Re: Textured Raycaster

Posted: Sun Aug 24, 2014 8:55 am
by Davidobot
Rukiri wrote:Wouldn't it be easier to pass arguments instead of hard coding the wood and red floor tiles?

Code: Select all

function drawInnerGround()
	love.graphics.setCanvas(groundInner)

	local on = false
	for x = 1, #map[1] do
		for y = 1, #map do
			love.graphics.setColor(255,255,255,255)

			if on then
				love.graphics.draw(img[6], x * 64, y * 64)
				on = not on
			else
				love.graphics.draw(img[7], x * 64, y * 64)
				on = not on
			end
		end
	end
	love.graphics.setCanvas()
end
Yes, but that's just to demonstrate that the floor is not all one tile. Best way is to have 2 or 3 maps. (Walls, floor, ceiling)

Re: Textured Raycaster

Posted: Sun Aug 24, 2014 2:04 pm
by Jasoco
Clouds wrote:Perhaps I'm being naive, but:
- Won't the floor and ceiling always be "behind" walls? Can't you just draw it without any raycasting, like a background, and draw over it with the walls?
- Wouldn't a mesh object make short work of any necessary perspective (and maybe tiling, if co-ordinates beyond the image dimensions will repeat)?
Mesh's are terrible at perspective. In that they do not do perspective at all. I find them useless and disappointing personally. I had hoped they'd solve my problem but eh. Whatever. The library I use that was created by xXxMoNkEyMaNxXx (I hate typing that name!) works perfectly and after testing performs exactly the same FPS-wise. If and when I ever do another Raycaster (Probably my next project) I will use it for my floors and ceilings.

Re: Textured Raycaster

Posted: Mon Aug 25, 2014 1:53 pm
by Rukiri
whenever I run into a wall I seem to get this error.
Error
floor.lua.54: bad argument #2 to 'draw' (Quad expected, got nil)

Traceback
[c]: in function 'draw'
floor.lua.54: in function 'drawfloor'
main.lua.92: in function 'draw'
[c]: in function 'xpcall'