Author Topic: [Lua] RayCaster  (Read 44060 times)

0 Members and 2 Guests are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Lua] RayCaster
« Reply #45 on: July 14, 2011, 02:35:30 am »
(I don't think Deron can PM with only 1 post but I don't know)

- I don't think Wolfeinstein was made in Lua. So Chockosta still had some work to do if he copied.
- If Chockosta had copied the code, he would not have only plain walls. So he didn't (I think).
- There is no point accusing Chockosta and letting all the others raycasting-makers, since Doom looks more like Wolfeinstein than this Maze.
« Last Edit: July 14, 2011, 04:09:07 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Deron

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +5/-64
    • View Profile
Re: [Lua] RayCaster
« Reply #46 on: July 14, 2011, 06:00:31 am »
You don't actually know if Chockosta used his code or not, so I wouldn't go and accuse him, a PM asking him about this would be more appropriate. However, if this is true, then Chockosta, you should give him credit.
Alright.

Vandevenne's code:
Code: [Select]
double cameraX = 2 * x / double(w) - 1; //x-coordinate in camera space
double rayPosX = posX;
double rayPosY = posY;
double rayDirX = dirX + planeX * cameraX;
double rayDirY = dirY + planeY * cameraX;
Chokosta's code:
Code: [Select]
cameraX=(x*2/w)-1
rayPosX=camera[1]
rayPosY=camera[2]
rayDirX=dirX+planeX*cameraX
rayDirY=dirY+planeY*cameraX



Vandevenne's code:
Code: [Select]
int mapX = int(rayPosX);
int mapY = int(rayPosY);
double deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX));
double deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY));
Chokosta's code:
Code: [Select]
mapX=math.floor(rayPosX)
mapY=math.floor(rayPosY)
deltaDistX=racine(1+(rayDirY*rayDirY)/(rayDirX*rayDirX))
deltaDistY=racine(1+(rayDirX*rayDirX)/(rayDirY*rayDirY))



Vandevenne's code:
Code: [Select]
if (rayDirX < 0) {
        stepX = -1;
        sideDistX = (rayPosX - mapX) * deltaDistX;
} else {
        stepX = 1;
        sideDistX = (mapX + 1.0 - rayPosX) * deltaDistX;
}
if (rayDirY < 0) {
        stepY = -1;
        sideDistY = (rayPosY - mapY) * deltaDistY;
} else {
        stepY = 1;
        sideDistY = (mapY + 1.0 - rayPosY) * deltaDistY;
}
Chokosta's code:
Code: [Select]
if rayDirX<0 then
stepX=-1
sideDistX=(rayPosX-mapX)*deltaDistX
else
stepX = 1;
sideDistX = (mapX+1-rayPosX)*deltaDistX
end
if rayDirY<0 then
stepY=-1;
sideDistY=(rayPosY-mapY)*deltaDistY
else
stepY=1;
sideDistY=(mapY+1-rayPosY)*deltaDistY
end



Vandevenne's code:
Code: [Select]
while (hit == 0) {
        if (sideDistX < sideDistY) {
          sideDistX += deltaDistX;
          mapX += stepX;
          side = 0;
        } else {
          sideDistY += deltaDistY;
          mapY += stepY;
          side = 1;
        }

        if (worldMap[mapX][mapY] > 0)
                hit = 1;
}
Chokosta's code:
Code: [Select]
while hit==0 do
if sideDistX<sideDistY then
sideDistX=sideDistX+deltaDistX
mapX=mapX+stepX
side=0
else
sideDistY=sideDistY+deltaDistY
mapY=mapY+stepY
side=1
end

if map[mapX][mapY]>0 then
hit=1
end
end



Vandevenne's code:
Code: [Select]
if (side == 0)
      perpWallDist = fabs((mapX - rayPosX + (1 - stepX) / 2) / rayDirX);
else
      perpWallDist = fabs((mapY - rayPosY + (1 - stepY) / 2) / rayDirY);
Chokosta's code:
Code: [Select]
if side==0 then
perpWallDist=math.abs((mapX-rayPosX+(1-stepX)/2)/rayDirX)
else
perpWallDist=math.abs((mapY-rayPosY+(1-stepY)/2)/rayDirY)
end



Vandevenne's code:
Code: [Select]
int lineHeight = abs(int(h / perpWallDist));
int drawStart = -lineHeight / 2 + h / 2;
if(drawStart < 0)
       drawStart = 0;
int drawEnd = lineHeight / 2 + h / 2;
if(drawEnd >= h)
       drawEnd = h - 1;
Chokosta's code:
Code: [Select]
hauteurLigne=math.abs(math.floor(h/perpWallDist))
drawStart=math.floor(-hauteurLigne/2+h/2)
drawEnd=math.floor(hauteurLigne/2+h/2)
if drawStart<0 then
drawStart=0
end
if drawEnd>=h then
drawEnd=h-1
end

Do you want more?

Hayleia I don't know what Wolfenstein has to do with all this, you clearly did not read either the content in the link nor my last message.
« Last Edit: July 14, 2011, 11:39:03 am by Deron »

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #47 on: July 14, 2011, 06:02:52 am »
Actually, I did not see that tutorial.
I just type "tutorial raycating" in google, and I found really many tutorials :

http://ressources.mediabox.fr/tutoriaux/flashplatform/affichage/3d/raycasting
http://www.permadi.com/tutorial/raycast/
http://zupi.free.fr/PTuto/index.php?ch=ptuto&p=intro
http://lodev.org/cgtutor/raycasting.html

All these ones are from the same tutorial.
I did not know how to make a raycaster, so I read all that. But I did not copy/paste them. And moreover, I had to port the code from a different language.
That's true, some variables have the same name. But I changed things, like the events, which are totally from me.
But you are right, I should have given credit to the tutorial author. That was not very nice, I am sorry. But there are at least 4 tutorials. So which one should I have quoted ?

If you tell me which one is the original, I will put a link in my first post, and apologies.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Lua] RayCaster
« Reply #48 on: July 14, 2011, 07:27:47 am »
Hayleia I don't know what Wolfenstein has to do with all this, you clearly did not read either the content in the link nor my last message.
Ok, I should not fight but I read your link and it is written "Wolfenstein 3D" so it is you that didn't read your link before speaking. So before saying people are stupid, look at you. As I don't want to start a fight, I will not answer you from now.
If you want to keep saying people copy others, go to the ASM forums and ask why they all use bcall(ClrLCDfull)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: [Lua] RayCaster
« Reply #49 on: July 14, 2011, 08:22:27 am »
Ok, I should not fight but I read your link and it is written "Wolfenstein 3D" so it is you that didn't read your link before speaking. So before saying people are stupid, look at you.
The thing he linked to was an raycasting tutorial. The mention of Wolfenstein there was only intended to serve as an example of what raycasting can do - that guy didn't make Wolfenstein or use any of its code.
If you want to keep saying people copy others, go to the ASM forums and ask why they all use bcall(ClrLCDfull)
The programmers there aren't trying to claim that they wrote ClrLCDFull. They just call it whenever they have to use it.

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #50 on: July 14, 2011, 08:36:40 am »
...
The programmers there aren't trying to claim that they wrote ClrLCDFull. They just call it whenever they have to use it.

But me, I wrote this raycaster. I followed a tutorial, but I wrote the entire thing.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: [Lua] RayCaster
« Reply #51 on: July 14, 2011, 08:41:17 am »
...
The programmers there aren't trying to claim that they wrote ClrLCDFull. They just call it whenever they have to use it.

But me, I wrote this raycaster. I followed a tutorial, but I wrote the entire thing.
Yes. We probably just stop fighting.

Offline Deron

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +5/-64
    • View Profile
Re: [Lua] RayCaster
« Reply #52 on: July 14, 2011, 11:53:20 am »
Hayleia I don't know what Wolfenstein has to do with all this, you clearly did not read either the content in the link nor my last message.
Ok, I should not fight but I read your link and it is written "Wolfenstein 3D" so it is you that didn't read your link before speaking. So before saying people are stupid, look at you. As I don't want to start a fight, I will not answer you from now.
If you want to keep saying people copy others, go to the ASM forums and ask why they all use bcall(ClrLCDfull)
The tutorial only mentioned Wolfenstein a couple of times, but it has nothing to do with the core content. Also, when did I say anyone was stupid? Furthermore, since when has discussing about an issue on the Internet become fighting?

...
The programmers there aren't trying to claim that they wrote ClrLCDFull. They just call it whenever they have to use it.

But me, I wrote this raycaster. I followed a tutorial, but I wrote the entire thing.
I stand my ground. A big part of the code was copied from the tutorial and you did in no way mention it or the creator of it. There's a difference in reading documents and making up your own mind (i.e. reading many tutorials and then writing your own code from scratch), and copying chunks from another person's code (it doesn't matter if you removed a couple of brackets and changed function names to make it work on the calculator, it's not what's important). He may have meant to have his code copied freely, but it still doesn't change the fact that it is disrespectful to pretend it was all made by you (don't tell me you didn't try to), when it clearly wasn't. It's not a crime; it's just a matter of education, respect and honesty.
« Last Edit: July 14, 2011, 11:58:06 am by Deron »

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #53 on: July 14, 2011, 01:09:02 pm »
Sure. I totally agree. Please read my post ( http://ourl.ca/12034/227840 ) and tell me which tutorial is the original one, then I'll mention it.

And I did not "removed a couple of brackets and changed function names". I used the tutorial author's code to create mine. Isn't it the purpose of a tutorial ?
Also, I'm not a great coder, and I've never done a 3D engine (even if it's only a raycaster) before that. So I have to train, and that's a training. It's absolutely not a finished program, it's a trial of an engine for a possible game.

You are right, I should have given credits to the author. But what you say is a little excessive, don't you think so ?

Offline Deron

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +5/-64
    • View Profile
Re: [Lua] RayCaster
« Reply #54 on: July 14, 2011, 02:03:57 pm »
Sure. I totally agree. Please read my post ( http://ourl.ca/12034/227840 ) and tell me which tutorial is the original one, then I'll mention it.

And I did not "removed a couple of brackets and changed function names". I used the tutorial author's code to create mine. Isn't it the purpose of a tutorial ?
Also, I'm not a great coder, and I've never done a 3D engine (even if it's only a raycaster) before that. So I have to train, and that's a training. It's absolutely not a finished program, it's a trial of an engine for a possible game.

You are right, I should have given credits to the author. But what you say is a little excessive, don't you think so ?

I shouldn't have to explain you this, but it's about material (or electronic, in this case) property, not about some tutorials which you read. I'm sorry if you do not understand that, but it should be very clear and obvious. What I can see is that your code resembles very closely to that of Vandevenne, because you blatantly copied big portions of code from him. There's nothing more to it. It should also be quite obvious that a honest gesture of an educated and respectful man would be at the very least to thank him for that, not go along and pretend you made it. The purpose of a tutorial is to be a tutorial, to teach and to show (or something along those lines). It doesn't matter if you took the code from a tutorial, from a book or from a donkey's ass, all that matters is that you took vast chunks of it from someone else. That you're not a very good coder and that it's not a finished program has absolutely nothing to do with this, it doesn't give you any special privileges. I suppose it all comes down to education and good manners, two fundamental things that many people lack.
« Last Edit: July 14, 2011, 02:14:56 pm by Deron »

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #55 on: July 14, 2011, 02:17:00 pm »
Please READ my posts !
I perfectly understand what do you mean.
I WANT to thank the tutorial author. But the tutorial that I followed I this one :
http://ressources.mediabox.fr/tutoriaux/flashplatform/affichage/3d/raycasting
It's not the same that you talk about, so I don't know the original author.
So I quote myself : "tell me which tutorial is the original one, then I'll mention it." and "If you tell me which one is the original, I will put a link in my first post, and apologies."

That's the third time I repeat that, so please READ before posting ! That is really annoying.

Offline Deron

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 7
  • Rating: +5/-64
    • View Profile
Re: [Lua] RayCaster
« Reply #56 on: July 14, 2011, 02:38:18 pm »
Oh okay, sorry my bad. I first thought that the fact that the variables dirX, dirY, planeX, planeY, cameraX, rayPosX, rayPosY, rayDirX, rayDirY, sideDistX, sideDistY, perpWallDist, mapX, mapY, hit, stepX, stepY, deltaDistX, deltaDistY, side, drawStart and drawEnd have the exact same name and do exactly the same thing in Vandevenne's was a coincidence.

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #57 on: July 14, 2011, 04:07:29 pm »
Mmmh.
I read your post more than 10 times, I still don't understand it. I think that it's ironic, but I really don't understand anything.
And anyway, it doesn't answer to my question.

Which tutorial should I mention ? I followed this one : http://ressources.mediabox.fr/tutoriaux/flashplatform/affichage/3d/raycasting and you talk about this one : http://lodev.org/cgtutor/raycasting.html
That's the fourth time I ask this, so if keep not answering, I'll just ignore you.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [Lua] RayCaster
« Reply #58 on: July 14, 2011, 04:18:59 pm »
Oh okay, sorry my bad. I first thought that the fact that the variables dirX, dirY, planeX, planeY, cameraX, rayPosX, rayPosY, rayDirX, rayDirY, sideDistX, sideDistY, perpWallDist, mapX, mapY, hit, stepX, stepY, deltaDistX, deltaDistY, side, drawStart and drawEnd have the exact same name and do exactly the same thing in Vandevenne's was a coincidence.
It's a good, easy to understand naming system. Im also using it for the raycaster I'm working on.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: [Lua] RayCaster
« Reply #59 on: July 14, 2011, 04:24:06 pm »
Hey Deron, quick question:  Why is the tutorial Chockosta followed ( http://ressources.mediabox.fr/tutoriaux/flashplatform/affichage/3d/raycasting ) and the one you believe he copied ( http://lodev.org/cgtutor/raycasting.html ) so similar?  By your logic one of these tutorials must be copied off the other.

On another note, Chockosta, you should have probably mentioned that you followed a tutorial in your first post. :-\