(0.9.0) Another raycasting demo 19.12.2013

Showcase your libraries, tools and other projects that help your fellow love users.
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

(0.9.0) Another raycasting demo 19.12.2013

Post by Wojak »

This demo (raycast5) in now compatible with LÖVE 0.9.0 + a little bonus
(bonus include resizeable window and the raycasting code moved to scripts/raycasting.lua file)

New version (raycast4) available, current futures include:
Animated 8 directional sprites
Variable resolution support
Variable player eye elevation and head tilt
Retexturing on the fly
Basic variable lighting
Basic world interactions
Other debug stuff
Frame limiter of sorts (needs tweaking)

All feedback is welcome, it would be awesome if you give me a performance report:

Computer specs, OS, resolution used, CPS limit used, amount of stuff on screen (rendering overall) and the FPS

http://www.youtube.com/watch?v=rXwtO4uS ... e=youtu.be

Image
Well I wanted to know how hard it is to make something like this, and learn something in the process.
I used this tutorial:
http://www.permadi.com/tutorial/raycast/
I think its quite a good tutorial because it only explains math and concepts, so I had to write the code myself, and because I’m not that good at math, it took me some time to understand it.
This should be enough for making a simple FPP dungeon crawling game that should run well on low end machines (I hope). I’m casting 1 ray for every 2pixel*screenheight and I don’t think it looks all that terrible, there is even a sprite support (the ugly rats are my creations), and some kind of basic light effect.
The floor and ceiling… Well I’ve managed to figure out how to draw it the oldschool way, but it kills any machine even on small resolution… I think it is possible to make a playable game without the floor…

Image
Attachments
raycast5.love
(0.9.0)
(32.67 KiB) Downloaded 1192 times
raycast4.love
new coll stuff (0.8.0)
(37.13 KiB) Downloaded 431 times
raycast3.love
with floors (0.8.0)
(8.08 KiB) Downloaded 475 times
Last edited by Wojak on Thu Dec 19, 2013 5:25 pm, edited 6 times in total.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Another raycasting demo

Post by Jasoco »

If you were around when I was playing with raycasting, I was able to make a floor using canvases.

Image

Which I also used when playing around with a Mario Kart type game.

Image

I don't know if giving you the code I used to do it would work well for your code, but if you want it. It does require canvases. But you could always make it optional like Blake Stone was. (It had options to turn ceilings and floors off for slower computers.)

Here's my original project just as it was when I stopped working on it and put the idea on hiatus. I might go back to it one day but it'll be recoded from the ground up anyway...
3D.love
(742.21 KiB) Downloaded 1083 times
The important ground stuff is in game.lua and background.lua. Maybe other places. I was really unstructured back then. My coding improves every time I start a new project. This is before I was much better so it's a bit of a clean hot mess.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Another raycasting demo

Post by qaisjp »

Looks interesting.
I see you've been busy, Wojak :)
Lua is not an acronym.
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Another raycasting demo

Post by Wojak »

Jasoco wrote:
I don't know if giving you the code I used to do it would work well for your code, but if you want it. It does require canvases. But you could always make it optional like Blake Stone was. (It had options to turn ceilings and floors off for slower computers.)

Here's my original project just as it was when I stopped working on it and put the idea on hiatus. I might go back to it one day but it'll be recoded from the ground up anyway...
3D.love
The important ground stuff is in game.lua and background.lua. Maybe other places. I was really unstructured back then. My coding improves every time I start a new project. This is before I was much better so it's a bit of a clean hot mess.
Well thank You, i certainly can learn a lot from your project, it is amazing :awesome:
qaisjp wrote:Looks interesting.
I see you've been busy, Wojak :)
And yet not a single 100% finished project :(
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Another raycasting demo

Post by qaisjp »

Wojak wrote:
qaisjp wrote:Looks interesting.
I see you've been busy, Wojak :)
And yet not a single 100% finished project :(
Bwahah, I know that feel (sorry I just have that temptation to not say "feeling", someone diseased me).
What are your plans with this demo :)?
Lua is not an acronym.
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Another raycasting demo

Post by Wojak »

qaisjp wrote:
Wojak wrote:
qaisjp wrote:Looks interesting.
I see you've been busy, Wojak :)
And yet not a single 100% finished project :(
Bwahah, I know that feel (sorry I just have that temptation to not say "feeling", someone diseased me).
What are your plans with this demo :)?
most likely rewriting this into FPP:
http://love2d.org/forums/viewtopic.php? ... 399#p71399
Wojak
Party member
Posts: 134
Joined: Tue Jan 24, 2012 7:15 pm

Re: Another raycasting demo

Post by Wojak »

Thanks to Jasoco I now have floor and ceiling :awesome:


Image


This canvases method is brilliant and I could never think of making it like this on my own, Thanks again Jasoco :D
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Another raycasting demo

Post by Jasoco »

It's not perfect, but at least it's fast. Just make sure to offer an option to disable them for people without canvas support.

Glad I could help. I forget who helped me with it back then. Could probably figure it out if we dug up my original thread. I want to say jfroco or something like that? It's been so long.
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Another raycasting demo

Post by Inny »

Those two raycasters at the top of google's search results have gotten implemented in Lua/Love so many times :P

It looks good though, I never bothered to try and get floors/ceilings in, but it's pretty easy doing some Z-axis stuff. For instance, simulating looking up and down is basically as easy as changing where the middle line on the screen is. It's not a particularly useful thing to have in this kind of raycaster, but lets say you use it to make an RPG of some kind, looking down momentarily when opening a treasure chest is a neat effect.
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Another raycasting demo

Post by jjmafiae »

looks good will you make it into a game with storyline and gameplay?

or just like alot of other lövers just making it for having some thing todo and have some fun :3
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 7 guests