Essentially, maze maker is a simple proof-of-concept for recursive scripting in Doom 3. I wanted to know if it was possible to program things like mazes and tree-based pathing with recursion, and the answer is yes, but only for very simple tasks (see notes, below). When a button on the GUI is clicked, the program randomly generates a "perfect" maze, meaning a maze where any one square has a path to any other square. You can drop down and run through the maze if you want, but the lighting might make that a little difficult.
This is a custom level that randomly generates a maze for the player. It was a proof of concept to test Doom 3's sdk. Mirrored here for archival purposes.
-----------------------------------------
Maze Maker v1.0 8/14/04
Martin "mwoody" Woodard, mzm@mwoody.com
-----------------------------------------
Map name: mazeMaker1
PK4 includes: new map w/scripts, new GUI w/graphic
-----------------------------------------
To run:
* Copy "mapMaker1" directory included in this ZIP to your "Doom 3" directory.
* Run Doom 3.
* Click "mods" on the main menu
* Select "mazeMaker1".
* Pull down the console (press CTRL-ALT-tilde, tilde being the ~ key to the left of the 1)
* Type "map mazeMaker1"
* Controls are on the panel to your left. Enjoy!
-----------------------------------------
Description:
Essentially, maze maker is a simple proof-of-concept for recursive scripting in Doom 3. I wanted to know if it was possible to program things like mazes and tree-based pathing with recursion, and the answer is yes, but only for very simple tasks (see notes, below). When a button on the GUI is clicked, the program randomly generates a "perfect" maze, meaning a maze where any one square has a path to any other square. You can drop down and run through the maze if you want, but the lighting might make that a little difficult.
-----------------------------------------
Notes:
* THE LEVEL WILL RANDOMLY CRASH when it tries to generate a level, dropping out to the console and generating a stack overflow. This error is not, to the best of my knowledge, due to a bug in the map or its scripting. Doom 3 has a very intolerant limit on recursion; it looks like around 20-30 calls or so will cause it to error out (that's less than Flash!). So recursion is an option only on VERY limited problems. If anyone knows a way to increase this limit (not just how to work around it to make the maze - I could do that, but this is a proof of concept, not an actual map) drop me an e-mail.
* The only difference between the 3 speeds of maze generation is the length of "sys.wait()" commands issued at each step. They are functionally identical.
* I've used the ceiling tiles here as a sort of stopgap boolean array (if the square over a space is hidden, we've visited that square before). If anyone knows how to make Doom 3 create an actual array, please let me know.
* You can increase/decrease the size of the maze generated in the source code; look for the maxSizeX and maxSizeY declarations. However, note that a larger map will increase the possibility of a stack overflow error.
* The mazeMaker1.script file in the PK4 contains extensive comments on exactly how the maze is created. Please look there for more specific info. To open a PK4, just rename it to ZIP and use WinZIP, WinRAR, or a similar program to unpack it.
-----------------------------------------
License:
Feel free to use this code in your own levels, though the current stack limit will probably make its usefulness quite limited. However, I do ask that any releases that include my source - whole or partial - abide by the following rules, which apply to all my work:
* Brief mention in the README, include my e-mail address
* Mention in the script file where the code appears, again including my e-mail address
* I would greatly appreciate if you'd drop me an e-mail and let me know where I can get your mod. I'd like to see examples, if they exist, of recursion in action.
-----------------------------------------
Thanks for reading; please enjoy!