Welcome to rednebula.com
This is the personal site of Bjarne Fich.
Site formerly known as "www.dragonslayer.dk"
Optimized for
Get Firefox!



I have now worked with OpenGL for some time. I have often browsed the net for demo’s and ideas. Here I have found a lot of maze programs, but no one in 3 dimensions. Why not? OpenGL is good for 3D… so I set out to make such a program.

3DMaze_exe.zip Runtime (.exe) (207K)

Graphically I have been inspired by many things, like Tron or the Matrix, but I believe the program have got its own style by now. I like the glasslike effect in transparent mode. Lovely.




I have realised that it is extremely difficult to move through a 3 dimensional maze. Even if it is only 5x5x5 and it becomes nearly impossible at 9x9x9. The maximum size is 20000 "cubes", i.e. 141x141x1 or similar, but you will get lost in there forever, and it will kill your computer in terms of performance.

A special cute version is to display a transparent maze in one level. This is an ordinary maze; you can study before you enter it.



Due to the difficulty of moving through a 3 dimensional maze, I have build a help function. Pressing “h” will cause the program to display “arrows” in the maze, pointing to the exit. (It cost a lot of score to use).

The score is for those who want that. It is a timer, starting when you enter the maze, and a timer displaying the time you have used the help function. The score is a sum of the two, where help time cost 30 times normal time. To move through the maze with a low score is what you play for…

In the data folder you can find the 9 xml definition files for the mazes. Modify them as you please to build mazes to your liking. Here you also find the setup.xml file, that determine the graphic screen set up (Size, full screen etc…)



Playing keys:

Movement:
a or up: Accelerate forward.
z or down: Decelerate.
q or left: Roll left (See also auto plane).
w or right: Roll right (See also auto plane).
space: Stop all movement.
Mouse up/down/left/right: Turn and tilt.

Misc:
Esc: Quit program.
1-9: Load mazes.
0: Randomise current maze.
h: Show help arrows in maze (cost score).

Flags:
s: Toggle solid/transparent walls.
p: Toggle auto plane. (Level to horizon).
l: Toggle Lines on walls (edges, and cross).
t: Toggle textures.
d: Toggle debug mode (show FPS and maze seed).
g: Toggle ground and sky display.

I have put the source code together with the program so you can use it if you wish. Some places is well commented, others are not commented at all. Fell free to be inspired. If you use it in your own programs, credit me or at least let me know you liked it.



Project compiles with Dev-C++ 4.9.8.0

3DMaze_scr.zip Source only (87K)
3DMaze.zip Runtime and Source (293K)


Main file list:

3DMaze:
Main.cppThe main file. This calls the open window, and handles the main program loop.
Macros.hpp
Globals.hpp
These two contain some macros and global variables. Among others the glwindow and the texture list.
Maze.cppHere I have put all the routines for the maze. Actually all the other files are made to be used in various game engines or experiments.
Log.cppAll the log file handling. I use this one a lot, not only for debugging, but often when I use code many months (or years) later, it might pop up with some nice information.
FileProcs.cppThis is encapsulating a lot of file handling routines, allowing me to read integers, tags etc from files.
GLWindow.cppWell... its openGl. This is the window (and some fonts).
Texture.cpp
Image.cpp
These two allow me to handle bmp, tga and jpg files. It also handles a dynamic list of textures, preventing the same file to be loaded twice.
Position.cppThe position class is my camera, and a class I usually uses to handle all my objects positions. It can translate etc. It also encapsulates the three math files (vector3d, quaternion and matrix). The file contains two main classes; position and movement. Movement can handle objects that move (like turning, tilting etc.) while position handle stationary objects. Check them both out.
Vector3d.cpp
Quaternion.cpp
Matrix4x4.cpp
Quaternion.cpp
Matrix4x4.cpp
The math files.
VectorText.cppThis is just a vector text font to be used in 3D. I use it for the entry and exit sign, as well as the intro text.


I myself have found many inspiring pieces around the net, especially NeHe’s tutorials. I believe we all have started by studying pieces of code and examples, and I would like to return the favour with this code.
Contact