whut
ok so i wanted to know if anyone was willing to teach me raycasting as ive wondered a long time about this.. just the way it works and how it works in fairly simple terms, thanks guys!
also how have i not heard of this?!
doom, 3d nukem, nice day for games major leap then but it was heavy on 286, 386 and 486 systems, am i that old...you was lucky if it ran on a 286, the nintendo 3ds is a super computer for that timeline!
Ok, to start with, raycasting like in Wolfenstein-3D or Spooky Maze isn't really 3D, it just looks 3D. For this type of game, the world is a two dimensional grid. Each location on the grid is either one of various wall types or an empty section of floor. Each wall type has a texture/image. Easy so far, I hope.
The player is at a point in the game world and is looking in a direction.
The player has a field of view. It is how much they can see to the left and right. Normally this is 60° or 90°.
The algorithm works on columns. You scan from the players location and angle minus half the field of view to the players angle and location plus half the field of view.
For each column you figure out how far a ray would go from the player's location along the calculated angle for the col
along the calculated angle for that column before hitting a wall. In fact you need to figure out where on that block it would hit. From the location on the block you can figure out which column of the block's texture/image to draw. Using the distance you can figure how big to scale it. Then draw the scaled column of the block's image/texture with a ceiling color above and a floor color after.
If you can find it, chapter 6 of 1994's Tricks of the Game Programming Gurus by LaMothe, Ratcliff, Seminatore, and Tyler covers it extensively in DOS C code.
Or you could just look at the spooky maze code. The author kindly made a raycating library to help you make your own 3D-ish games. Doom actually uses something else called a BSP tree. Not sure if you can do that in SmileBasic with no pointers, but it allows for non-grid geometry. However it wasn't really 3D either, but Quake was.
hmm.. so I have more questions.
the walls and objects, are they sprites? or are they bg tiles?
also how do they bend to the grid used; ive tried to bend sprites in certain ways but I have never found out how to bend them in a way that turn certain angles..
but ill be reading the thingy now thanks!
Sorry, I know it sounded that way. I know you've gotten pretty good with SB, I didn't even know all that, what Stewart said. I've seen on YT vid a while back, for using ray-casting in a top down 2-d for lighting and stealth detection. It was pretty advanced, way over my head math wise.
so i learned a lot about it and now i was wondering if theres a way to make it full screen like in spooky maze because my current one is like this.
also im feeling very good to it and teally wanna learn more, might make a demo game with it.