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

Showcase your libraries, tools and other projects that help your fellow love users.
Clouds
Prole
Posts: 23
Joined: Tue Nov 27, 2012 4:06 am

Re: Textured Raycaster

Post 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)?
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post 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.
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Textured Raycaster

Post 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
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post 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.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Textured Raycaster

Post 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 ;)
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post 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.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Textured Raycaster

Post 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
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Textured Raycaster

Post 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)
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Textured Raycaster

Post 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.
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Textured Raycaster

Post 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'
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests