Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RPGeezus

Raycasting (ie Wolfenstein) problem

This topic is 5453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been writing a ray caster off and on using some horrible development tools (read no debugger). I cannot change this for the time being. The code works on a grid, just like Wolfenstein, and I cast rays looking for vertical and horizontal intersections. I've run in to a problem where I'm seeing my walls not being drawn like boxes, but instead being draw like this: (overhead view) .----. |.....| |.....| |___|_ ,,,,,,| (please ignore the ') The right and bottom walls seems to be too long! To illustrate the problem, imaging your were looking down a hall way: ie: xxxxxxx -> xxxxxxx What you would see with my engine would be a nice smooth wall to your right, and on the left you would see the smooth wall interupted every wall length by a short perpendicular wall. ie (over head view) xxxxxxxxxxxxxxx ...x......x......x... ..................... xxxxxxxxxxxxxxx Has anybody run in to this problem before? Any help would be appreciated. Will [edited by - RPGeezus on October 20, 2003 4:54:16 PM] [edited by - RPGeezus on October 20, 2003 4:55:05 PM]

Share this post


Link to post
Share on other sites
Advertisement
Your distance-calculation is not correct, or the values for it.

Note that (tileX, tileY), where coords are ints, gives the upper-left corner of a tile. Things will work when you calc the distance to the walls to the right of the view in your pic, because you take the distance between the viewpoint and the upper-most edge of the tile. OTOH, for the left walls, u need to take the distance from the viewpoint "to the lower edge", thus add one tile to Y.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!