Table of ContentsAdvanced FeaturesChapter 22.            Making the Connection

Conclusion

As you saw, the basic concept of ray casting is pretty simple. You simply project rays into the world along the vertical and horizontal tile boundaries and, when you hit something, draw a wall relative to the distance the ray traveled. Do that for all the angles in the field-of-view, and you've got a reasonable 3D image.

The code you saw in this chapter does a good job of creating a ray-cast view; however, there's plenty of room to improve the performance and add cool features. Turning this basic engine into a game will be the fun part.

Ray casting won't produce results like Quake III, but it's an effective method for producing a great-looking 3D view you can use in all sorts of game types. Be creative with what you've got, and you'll be surprised how good the results can be.

    Table of ContentsAdvanced FeaturesChapter 22.            Making the Connection