Raycasting Demo (like Wolfenstein3D, just veery basic)

Showcase your libraries, tools and other projects that help your fellow love users.
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by pekka »

This works quite well on my old computer with a 1.6 GHz proc. I get a framerate of 100 to 50 or so, with the fifties happening in the big area while viewing a lot of distant walls. Nice work for such a short bit of code :)

I think you've misspelled alpha as apha inside an if test, though. Lua doesn't warn you about that, it just treats apha as nil if it is not assigned a value anywhere.

A reminder about vsync: You can set many graphics cards to always disable or enable vsync. What you have in the config or the code is just a suggestion at best.
User avatar
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)

Post by bartbes »

I never set it in my vid card settings, but I really don't see a reason to ever disable vsync. (well, unless you're benchmarking or testing, but not for a released game)
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by pekka »

The important situation here is when you distribute your game. Even if your game sets its vsync on (or off) just fine on your computer, it may not do so on all of your users' computers. It's just not guaranteed to work the same everywhere because someone might have a good reason to have other settings than what you expected.
User avatar
pygy
Citizen
Posts: 98
Joined: Mon Jan 25, 2010 4:06 pm

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by pygy »

Thanks for spotting the alpha typo :-) It's not used in this game, and I never used it anywhere before, that's why I hadn't caught it (yet?).
Hermaphroditism is not a crime. -- LSB Superstar

All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by kalle2990 »

I get 15-25 FPS when I run at these configurations:

Code: Select all

config.width = 1680 -- width of window
config.height = 1050 -- height of window
config.fov = 60 -- field of view (degrees)
config.sliver_width = 1 -- thickness of each wall sliver (pixels)
config.ray_resolution = 1/5000 -- lower number = higher resolution = more accurate = more CPU
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by Jasoco »

You need to make it so the player slides along the wall if walking into it rather than just stopping abruptly. Also, the player needs a radius. Right now it seems the player's view can go right up to the wall instead of pushed off a few pixels like it should.

I still say we look at the Wolfenstein 3D code. I just don't understand how to translate C++ or whatever they used to code it.

I have the installer, an old EXE for DOS. I'll load up DOSBox and install the code again and look at it. But there is a LOT of code. It's hard to figure out what file is just for the drawing engine.

I mean really, the hard part is figuring out the correct math. If only Löve could stretch images between points. As opposed to scaling them. I want to be able to say top X and Y are here, bottom X and Y are here instead of Place this image here and scale it up this much. Because without that, it's hard to make an engine that can do image mapped walls. JavaScript can do it with the Canvas feature. I think Löve should be able to too.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by TechnoCat »

Jasoco wrote:I mean really, the hard part is figuring out the correct math. If only Löve could stretch images between points. As opposed to scaling them. I want to be able to say top X and Y are here, bottom X and Y are here instead of Place this image here and scale it up this much. Because without that, it's hard to make an engine that can do image mapped walls. JavaScript can do it with the Canvas feature. I think Löve should be able to too.
http://love2d.org/forum/tracker.php?p=2&t=19
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by Jasoco »

Niiiiiiice. When that's implemented, things are gonna be a lot more fun.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by TechnoCat »

That is a feature request, not something they will do.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Raycasting Demo (like Wolfenstein3D, just veery basic)

Post by Jasoco »

But it IS something they should do. They must! For the sake of the future of Löve!!
Post Reply

Who is online

Users browsing this forum: slime and 58 guests