Page 1 of 3

(0.9.0) Another raycasting demo 19.12.2013

Posted: Fri Jun 07, 2013 5:57 pm
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

Re: Another raycasting demo

Posted: Fri Jun 07, 2013 6:06 pm
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 1079 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.

Re: Another raycasting demo

Posted: Fri Jun 07, 2013 7:14 pm
by qaisjp
Looks interesting.
I see you've been busy, Wojak :)

Re: Another raycasting demo

Posted: Fri Jun 07, 2013 7:33 pm
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 :(

Re: Another raycasting demo

Posted: Fri Jun 07, 2013 7:35 pm
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 :)?

Re: Another raycasting demo

Posted: Fri Jun 07, 2013 7:38 pm
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

Re: Another raycasting demo

Posted: Wed Jun 12, 2013 5:32 pm
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

Re: Another raycasting demo

Posted: Wed Jun 12, 2013 9:55 pm
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.

Re: Another raycasting demo

Posted: Fri Jun 14, 2013 9:34 pm
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.

Re: Another raycasting demo

Posted: Fri Jun 14, 2013 9:51 pm
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