Page 2 of 2

Re: How to draw the floor in raycasters - scaling problem

Posted: Tue Oct 11, 2022 7:41 am
by Koxinga
And here are the phone screenshots. Weird, isn't it ?

Re: How to draw the floor in raycasters - scaling problem

Posted: Tue Oct 11, 2022 11:01 am
by Koxinga
It's indeed a problem with DPI scaling.
I can get it working by adding

Code: Select all

t.window.usedpiscale = false
in conf.lua. But the text is messed up (really tiny) and it's pretty slow (because the screen has a massive number of pixels, I suppose).

Guess I'll have to put it back to "true" and find a way to deal with DPI stuff in the shader. If you have any docs about it, I'd be very glad.

Thank you to everyone.

Re: How to draw the floor in raycasters - scaling problem

Posted: Wed Oct 12, 2022 9:02 am
by pgimeno
There's love.window.toPixels and love.window.fromPixels to convert back and forth, and love.graphics.getDPIScale to get the units-to-pixels ratio. Not sure where that will be necessary. If you're using canvases, you can specify dpiscale = 1 for the canvas; see love.graphics.newCanvas.

Re: How to draw the floor in raycasters - scaling problem

Posted: Thu Oct 13, 2022 10:17 am
by Koxinga
Hey guys !

I finally solved the problem. After a lot of debugging, I found that the DPI scaling was not the cause of the problem... My calculations were. I was calculating some lengths in "units" (according to my grid) and some in pixels. For a reason I don't really know, it seemed ok on my computer when it shouldn't have.

Now that it's done, I can focus on game mechanics (the best part)

Thanks again to everyone.

Re: [SOLVED] How to draw the floor in raycasters - scaling problem

Posted: Wed Oct 26, 2022 6:36 pm
by Jasoco
pgimeno wrote: Fri Oct 07, 2022 10:26 pm Raycasting and real 3D are fundamentally different. Real 3D is hardware accelerated and cheap for the CPU; true raycasting is CPU-expensive. It's possible to simulate raycasting with real 3D.
I'll echo this statement. I was working on a Wolfenstein style ray caster a while ago. A few times actually. I had started the project years ago and gave up for a while before coming back to it. I put a lot of work into it and made it look really really neat with a lot of features, but in the end it was always an issue of the raycasting itself using a lot of CPU time. So if you were looking in a direction where there's a lot of tiles, even ones you really can't actually see, it would use more CPU time and sometimes slow things down even on a small enough map.

Then Groverburger released his g3d engine and I switched over to it. It's much more efficient to just use 3D and pretend it's 2D than to do it in 2D. It's ironic but it's true. I'm still working on getting my new true 3D engine up to par with my old 2D Raycaster though because there were a bunch of things I could do with the raycaster that I can't do as easily with true 3D. But I'll figure it out I'm sure.