Table of Contents

3D
Creating a cutting-edge engine
  01 - Design document
  02 - Overall structure

  03 - Binary Space Partitioning
  04 - Constrctive Solid Geometry
  05 - Portals
  06 - Possible Visible Set
  07 - Radiosity lighting
  08 - Mirrors

Dictionary of 3D terms

OTHER
A Genetic Algorithm
Line drawing
Line clipping
Line antialiasing
Line thickening
Line curving

Resources in print
Resources on the web
Resources to download

Bad: see shamon
Hee hee!
02 - Overall structure
The overall structure of your program is absolutely crucial and must be thought out even before you start up the IDE/text editor/stone table and chisel. As it is said in The Tao of Programming:
"When I first began to program I would see before me the whole program in one mass. After three years I no longer saw this mass. Instead, I saw subroutines. Now I see nothing."
What it means is that once you develop the intuitive understanding you will auto magically take into consideration the overall structure and work with the flow, thus making your life a lot easier.

If you're a self taught programmer then it's very likely no one ever taught you how to structure your software code. Well today you're in luck, 'cause I'm going to let the secret out. ALL programs, to one degree or another, have the same fundamental parts:
  • The Model is the set of all data that you are manipulating in the program. In the case of a 3D engine it would include the world model, the sprites, the motion paths, the sound effects, the world events, etc... Properly designed, (IMHO) the model shouldn't have to contain any platform-specific code.
  • The Graphic User Interface (GUI) is all parts of the program that provide an interface with the user. In the simplest case it's a command prompt. In our case it's probably a full screen, multimedia extravaganza with fully configurable input devices and a plethora of different rendering and sound systems. Simply put, it's a user-friendly way of drawing the polys and playing the sounds.
  • The Controller is the part of the program that provides a connection between the GUI and the model. It is the entry point into the program and basically runs the whole show.
Each of these sections should be as independent of each other as possible. In other words the GUI should never call the model, the model should never call the GUI and neither should call the controller. It may turn out that it is unavoidable, but try your damnest not to break this rule because if you do you develop a cyclic dependency which is BAD.

At the time I wrote this page, my engine structure looked, in part, like this:

zViewer engine design

Which is nothing compared to my original idea:

zViewer original engine design


Technically speaking you should develop the controller, then the model, then the GUI. However, reality says you should test at various stages so you have to develop each in part simultaneously. It would be very very difficult to develop first one and then the other. Ever try to debug 500k of code? Two words: nervous breakdown.

But enough of all these preliminaries, let's skip to the last chapter and learn something really mind blowing!

Back to the top
PREV: The Design document
NEXT: Binary Space Partitioning



All photos copyright of their respective owners. All other content of this website is © 1997-1999 Dan Royer.
Designed for IE 5.0+, 800x600x16 or greater. Some pages use style sheets.
http://members.home.com/droyer/index.html