News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Looking for a bit of help.

Started by Scott_Bro, June 29, 2021, 02:11:26 PM

Previous topic - Next topic

Scott_Bro

I've started a raycaster engine over again hoping for less trouble and better operation.
So far so good but...
I'm having trouble with the way some corners are looking leaving open cracks.
Does anyone have a way to fix this or a work around?
Tnanks
Scott B.

stevmjon

having a look at this now. see what i come up with.

i like breaking down code to see how things work. i like making game engines more than actually designing a game level.
just allow some time for me to break down the code to test. i will post as soon as i come up with any idea's.

stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

stevmjon

i found the issue. what is happening is when you calc the slope for x1_ray/y1_ray when this is very close to the corner, eg. x cell = 3 , y cell = 2. then when you calc the ray a second time for the slope x2_ray/y2_ray when this is very close to the same corner the values are slightly different, so now x cell = 2 , y cell = 2. so it now thinks the wall is not a collision and calcs past it.

the values we are talking is only @0.3 of a difference on a value, but that takes it to the other cell.
see pic for a visual explanation.

hope this helps, stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Scott_Bro

Got the corners now.

But can anyone figure what is causing it to crash ever so often???

I need to work out this bug!

Any help would be greatly appreciated.
Thanks ahead of time.

stevmjon

i haven't seen the crash yet on my rig, but i did notice the frame rate is very low. so for a bit of a speed boost use fx images instead of video images. video images are default using command "loadimage", but these are very slow to read from, in this case using the "texturestripv" command. i recommend using the "loadfximage" command instead.

hope this helps till you figure out the crash, stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.