[General] RayCasting
Posted: Thu 17 Aug, 2006 12:20 am
I am looking to make true RayCasting engines in as many languages I know, including BASIC, JavaScript, C (learning it), and finally z80 ASM.
I am looking for detailed help on it, (not those tutorials). It would be best if help was written in somewhat plain english, and chances are I will question everything that I can. psudeocode is best, but chances are I will format this to work in Chipmunk BASIC first (fastest BASIC program for the Mac) and then JavaScript, by then hopefully I would have learned enough C, to make one in TIGCC (or w/e the acryonym is) and begin to make games.
Any help is good, here's what I know already...
RayCasting uses defined things like screen width, to send out "rays" from the players eyes to the walls and objects so you can see them. A ray is "cast" from the player along a grid until it hits 2 walls, then displays the part of the wall that is closer (this is why it is good to have "brick" or "block" walls and is harder to do a DOOM like engine with diffrent angles of walls, and easier to make a W3D game) as a scaled sliver of a bitmap. Then it moved onto the next ray, so if my screen is 90px wide, then I need to cast 90 rays (or however many rays is needed, here the player sees 90degrees, I can always be nifty and make the view narrow as the player moves faster (like when driving) to improve speed). I can simulate looking up and down, by moving the player's viewpoint along the Y axis up and down.
I also know that there is a good bit of trig involved (I should be able to handle it) as well as a bit to reduce the fact that when looking at a flat wall the engine will make it bulge.
As for hit detection, well since it is a grid I can probably use the same method I use in p3d, where the iPart of the number is what is on the wall, and the fPart of the number is what the wall is (so I can make secret doors, fake doors, broken consoles, and hidden consoles, and whatnot)
I do not know how to place enemies and items on the screen.
Hmm, I think that about covers it. Anyone care to help me?
I am looking for detailed help on it, (not those tutorials). It would be best if help was written in somewhat plain english, and chances are I will question everything that I can. psudeocode is best, but chances are I will format this to work in Chipmunk BASIC first (fastest BASIC program for the Mac) and then JavaScript, by then hopefully I would have learned enough C, to make one in TIGCC (or w/e the acryonym is) and begin to make games.
Any help is good, here's what I know already...
RayCasting uses defined things like screen width, to send out "rays" from the players eyes to the walls and objects so you can see them. A ray is "cast" from the player along a grid until it hits 2 walls, then displays the part of the wall that is closer (this is why it is good to have "brick" or "block" walls and is harder to do a DOOM like engine with diffrent angles of walls, and easier to make a W3D game) as a scaled sliver of a bitmap. Then it moved onto the next ray, so if my screen is 90px wide, then I need to cast 90 rays (or however many rays is needed, here the player sees 90degrees, I can always be nifty and make the view narrow as the player moves faster (like when driving) to improve speed). I can simulate looking up and down, by moving the player's viewpoint along the Y axis up and down.
I also know that there is a good bit of trig involved (I should be able to handle it) as well as a bit to reduce the fact that when looking at a flat wall the engine will make it bulge.
As for hit detection, well since it is a grid I can probably use the same method I use in p3d, where the iPart of the number is what is on the wall, and the fPart of the number is what the wall is (so I can make secret doors, fake doors, broken consoles, and hidden consoles, and whatnot)
I do not know how to place enemies and items on the screen.
Hmm, I think that about covers it. Anyone care to help me?