Raycasting without .dll's

Started by MisterN, August 02, 2011, 03:32:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

theosk

I don't know if this issue was addressed in bennu:
There are some lines like this in my code:

if(rayDirX==0.0)rayDirX=0.00000000001;end

that's because floating numbers should allow division by zero in c++ (there's an IEEE code for infinite), but fenix segfaulted anyway, so I had to do that in order to avoid divisions by zero. Sorry for the massive offtopic, but I didn't feel like a new thread was worth for this alone :/

SplinterGU

float divisions by zero in bennugd give you infinite....
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

theosk

Woah, that was fast. Thanks, then the code should run without all these lines now :)

SplinterGU

Quote from: theosk on December 31, 2012, 12:09:09 AM
Woah, that was fast. Thanks, then the code should run without all these lines now :)

well, without these lines, in 320x200, without scale2x and replace all fabs by abs... it give me to up 110-180fps... depend what need render on screen... oh, I remove the draws functions too.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

theosk

Well, this code was written in fenix some time ago so I had to do REALLY weird things to avoid some old bugs. (abs wasn't even working properly with floats back then... tough times). The drawing functions were meant for higher resolutions, where small sized tile slices became less than 1px wide and wouldn't draw and far away walls became invisible, so fog-like brown lines would fill these gaps. That's why there are various sized tile slices, not the right thing to do, but the way it would work fast enough back then.

Over 100 fps is a huge boost, for sure! I should update myself regarding the current divlike scene, I'm glad to see things are moving forward over here.

l1nk3rn3l


MisterN

so can you post the updated code?
werg

Imerion

Yep, would be nice to see the updated source! :)
Try my games : Neotron Games

SplinterGU

Quote from: theosk on December 30, 2012, 11:49:38 PMHi, I attached my code to this post.

There's a version without textures too, which boosts the FPS counter to infinity. I'm sorry for this horrible piece of code, It was an almost direct conversion of the tutorials and I was learning about raycasting on the go. I lost interest once I got it working so I don't think I'll keep working on it. If you find this useful at all, please feel free to do whatever you wish with this :)

Marvelous! After 11 years, I just ported it to BennuGD2, and it's working wonderfully!
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Goku jr

It even works, on switch!! although with a significant drop in fps compared to a PC