3-D Programming
[Prev][Next][Index][Thread]
3-D Programming
Okay all you people who keep asking about 3-D games. I am going to release
some highly secretive info. that only advanced programmers know about (and
who subscribe to several Game Development magazines or spent $250 on game
programming books). Here is the low-down on how a 3-D engine works:
"slivers" and ray tracing
I will be using the game Wolfenstein 3D for my discussion (DooM works in a
totally different way but has the same 3-D principles).
Ray Tracing is just a process of taking a central point (the user's current
location) and "drawing" a line till it hits a wall/object on a 2-D map
(DooM uses a Binary Tree format for its levels...not a 2-D map). If you
span multiple lines so that they cover an area of 60 degrees (Field Of
Vision or FOV), you can produce a realistic 3-D image. If you use sines
and cosines for the line, you will need to account for the fact that you
are super-imposing polar coordinates onto rectangular coordinates. Without
counteracting this, you will end up looking through a fish's eye view in
the 3-D world.
"Sliver" is a technical term for drawing a scaled sprite. My SpriteDraw
routine just needs a little editing and it will be ready for 3-D games. A
"sliver" is just a single-pixel width sprite that has been scaled according
to the Ray Tracer. All a 3-D game is made of is a bunch of little slivers.
I hope that I have helped someone understand what a simple 3-D engine is
made of. If you don't understand any of it, just e-mail me and I'll be
happy to tell you. The source of this info. came in a book called "Tricks
of the Game Programming Gurus." Dadelus (for the TI-85) was written using
this and another book (can't remember the name).
Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
http://www.geocities.com/SiliconValley/Heights/8504
http://shinelight.home.ml.org
Follow-Ups: