DwTGen1, by Blockhead aka Peter Capasso

	This is a random dungeon generator written in C.  It generates
dungeons for Tribunal in the very large Tribunal Dwemer style.  Source code is
included.
	This is a command line (DOS) (windows console) program.  There is no
GUI.  To use this program, it is assumed that you have a fair grasp of DOS
and are fairly comfortable with the Morrowind mod editor (TESCS).


Quick "I hate reading manuals" usage of DwTGen
----------------------------------------------
	Make a new directory.  Put all the files in there.  Don't forget
espjoin.exe and txt2esp4.exe (separate downloads)!  Open a DOS and cd to that
directory.  Type:

 dwtgen1 my_dungeon 3 "My Dungeon"

	After it runs, type:

 try

	After that runs, switch to explorer (or your favorite file manager)
and copy my_dungeon.esp to the data files directory off of Morrowind.  Load
it up in the editor, making sure to first put an X next to Tribunal.esm.  Add
doors connecting one of the dungeon cells and the outside world.  Save it.
Exit the editor.  Run Morrowind.  Activate the plugin.  Play.


	Now the longer more detailed information, for those not in quite as
much of a hurry.

Installing DwtGen
-----------------
	Make a new directory.  Unzip all files to that directory.  If you
haven't downloaded txt2esp4 and espjoin, go get them.  Put them in the same
directory with dwtgen.  Open a DOS whenever you want to use dwtgen.  Note, if
you have ImpGen or BluGen or DweGen already, you might want to keep the dwtgen
files in that same directory.  They all use separate INI files so there will
be no INI file name collision.  The source for all the programs use a file
called hacks.h but the file is identical so don't worry about that file name
collision.


Using DwTGen
------------
 dwtgen1 <outfile name> <size> <base cell name> [-t] [-m] [-c] [-nt]
 [-l #] [-sl #]

where '#' represents a number.

	Outfile name is the name that you want to use for the final esp file
name.  It must not have spaces in it.  Do not specify the file extension ...
dwtgen will add that.
	Size controls the number of cells generated.  Setting this to 1 will
generate one cell.  Setting this to 2 will generate a dungeon three cells by
three cells, for a total of nine cells.  Take the size number, double it,
subtract 1, and then square it to get the total cell count of the output
dungeon.  Here's a table that ought to make it clearer (set your text reader
to a non-proportional font like Courier to see the table correctly):

 size  cells on a side  total cell count
 ----  ---------------  ----------------
  1           1                 1
  2           3                 9
  3           5                25
  4           7                49
  5           9                81
  6          11               121
  7          13               169
 99         197             38809

	99 is the upper limit.  You should never have to use that.  I'm afraid
to try it.  The dungeon would be too big.  It might not fit on the hard
drive.
	Base cell name is the cell name that you want the interior cells to
have in the game.  This base name, plus the cell coordinates, will form a
unique name for each cell.  This can have spaces in it, as long as you put
quotes around it.
	-t, -m -c, -nt, -l, -sl are optional command line switches to set
options for dungeon generation.  They can be used in any combination.
	The -t option turns off treasure generation.  When this is set, there
will be no crates, bags, small chests, gemstone, etc. in the dungeon.  Any
clutter that is placed on top of crates (like those squat candles) will not be
created either.
	The -m option turns off monster generation.  When this is set, no
monsters are placed in the dungeon.
	The -c option turns off clutter generation.  This turns off anything
that is not monster or treasure.  When this is set, there will be no lights
in the dungeon (aside from lights on crates, if treasure is left on), no
chairs, and no sounds.
	Using all three options at the same time will generate a dungeon that
is a bare stone maze, ready for whatever manual decoration you wish to do!  :D
	The -nt (no twisty) option will force nub removal to always be 2
passes.  This results in almost all of the dead end corridors being removed.
This makes the dungeon less twisty but will help your in-game frame rate a
little bit.  Without the option, the program randomly determines the
twistyness for each cell.
	The -l option allows the dungeon to extend vertically down, similar to
the way GenMod works.  Doors connect cells between levels.  Any number from 1
to 1000 is allowed.
	Note: the cell with coordinates (0, 0) will always have inter-level
connections.  Other cells only have a 1 in three chance of having an up trap
door and and 1 in 3 change of having a down trap door.
	The -sl option allows the number of the first level to be set.  So if
you want your dungeon to have levels 101 to 200, you would type something
along the lines of:

 dwtgen1 my_file 3 "My Dungeon" -l 100 -sl 101

	While the generator will only make 1000-level dungeons, you can use
-sl to specify higher number ranges, for example:

 dwtgen1 my_file 3 "My Dungeon" -l 1000 -sl 10000

will result in a dungeon with levels from 10000 to 10999.  So one can render
a dungeon in pieces of 1000 (or less) levels at a time and chain them in the
regular editor to get dungeons larger than 1000 levels.
	After running dwtgen, you'll have one text file for each cell of your
dungeon.  There will also be a single list file and a single .bat file.
If you run the bat file, it will call txt2esp4 and espjoin to convert all of
the text files into esp files and then use the list file join those esp files
into one final esp file.
	Move the esp file into the data files directory off of your Morrowind
directory.  Now run the regular Morrowind editor (the Construction Set).  At
this time, you've got to make sure that BOTH Morrowind.esm AND tribunal.ESM
are checked.  The reason for this is that txt2esp4 does not write the proper
Tribunal dependency to the esp file.  Once you've got both ESMs X'ed, scroll
down and click on your ESP and make it the active file.
	Now save the ESP.  It will now have the proper Tribunal dependency.
	Now all you need to do to play the plugin is add doors to and from the
dungeon.  The temporary text files and temporary esp files can be deleted,
as can the list file and the .bat file.


Ini file
--------
	When dwtgen runs, it looks for a file called "dwtgen.ini".  The
program expects this ini file to be in the current directory.  It will run
without the ini file but will complain about it.  You may never have to change
this file, but in case you do, here is how it is laid out.
	The dwtgen.ini file consists of seven sections, "files",
"leveled_creatures", "crate", "bag", "small_chest", "desk" and "drawers".
Each section starts with its section name in square brackets and ends with an
empty line.  There must be an empty line between sections.  There must not be
an empty line between lines within a section.
	The files section can name *one* already-existing esp file to include
into your dungeon.  This is where you could create custom leveled creature
lists or containers (in the regular TESCS editor that comes with the game).
The syntax is:

 include_esp_file yourEspfilenamehere.esp

	Also in the files section is the "out_bat_file" command, which allows
you to specify the name of the .bat file that dwtgen creates.  The default
name is try.bat.  The "out_list_file" command allows the name of the list file
to be specified.  This name change will be reflected correctly inside the bat
file.  The default name is list.txt.
	Also in the files section is the "delete_temps" command.  Putting this
command in the ini file will cause dwtgen to write del commands to the bat
file to delete all of the temporary files except for the list file and the bat
file.  To not delete temp files, remove the "delete_temps" line from the ini.

	The leveled_creatures section allows you to specify up to 20 leveled
creatures, each on its own line.  The program will pick from among these with
equal priority.  So if you wanted one leveled creature to appear more often,
put it in more than one time.  Putting a creature here will not work, it must
be an existing leveled creature.  If you want to use your own leveled
creatures you must first define it and save it as an esp file.  This esp file
must then be named in the INI file using the include_esp command.  The default
monster assortment is a mix of the Tribunal Dwemer leveled list and the
Morrowind Dwemer leveled list and a 1/5 chance of a leveled tomb creature.

	The crate section allows you to specify up to 20 crate container
objects.  Any container can be used, so long as it uses the same NIF as
crate_02_pos or crate_01_pos.

	The bag section is like the crate section, except for bags (sacks, the
game calls them).  Again, as long as it uses the same NIF as com_sack_02_pos,
any container can be specified here.

	The small_chest section is like the crate section.  As long as it
uses the same NIF as chest_small_02_misc01, any container can be used here.

	The desk section works as above.  As long as it uses the same NIF as
dwrv_desk00, any container can be used here.

	The drawers section works as above.  As long as it uses the same NIF
as dwrv_drawers00, any container can be used here.


Legal Crap
----------
	Do whatever you want with it.  Upload/copy it where ever.  Just try
to mention my name if you can.  :)
	The program runs fine on my computer but your mileage may vary.  You
use this program at your own risk!


Extra Notes
-----------
	DwTGen reads from and writes to a four byte file called
"seedhold.dat".  This is simply the random number seed from the last run, to
be mixed with the system time on the next run.  This file is also used by
txt2esp4.  The reason for this file is that the seed for the random generator
is gotten from a time function that only updates to the nearest second, so
that if you run a program twice in one second, both runs have the same random
number seed.  Use of the seedhold.dat file gets around this.
	The grid formed by Tribunal Dwemer pieces is 1024 units.  This is four
times the size of the grid formed by Imperial pieces.  It is the largest tile
set in the game (unless they put something larger in Bloodmoon).  The cells
made by DwtGen get very large: the interior cells created by DwTGen are each
13,312 units on a side.  Compare this to an exterior cell, which is only 8,192
units on a side.  If you want to make a dungeon big enough to go under all of
Vardenfell, type:

 dwtgen1 big 14 "Dwemer UnderWorld"

	Despite its monotony, I really like the huge-sized Tribunal Dwemer
tile set.  I've changed the clutter and monster placement algorithms to fit
the much larger size and I am very pleased with the results.  There is more
treasure, but there are more monsters, especially in the rooms.  Dungeons
created by this generator are tougher than those created by my other
generators.  Also, I have mixed some old style tribunal elements in with the
Tribunal style pieces.  Load doors are old-style Dwemer and the load doorjams
are constructed out of old-style Dwemer hall pieces.  Old-style Dwemer neon
lights are scattered along with Tribunal Dwemer lights in the halls.
	Other dungeon styles (tile sets) have been created as separate
programs, because they each vary the algorithm in little ways.  To write a
general algorithm would be a pain in the neck and would invite error.
	Feedback, comments, etc. on DwTGen are best posted on the Elder
Scrolls forums in the mods & plugins section.
	This is version 1 of the .c program.
	I could not have created this program without the Morrowind ESP
Format file that was created by Erik Benerdal and Jim Adam.  Thanks
guys!
	Thanks to Jim Adam for creating GenMod, which inspired this program.
If you have not already downloaded it, go get it!  It's up to version 2.5 as
of this writing and some really neat stuff has been added.  I even helped out
with some of the tile sets.
	Thanks to all of the suggestions/comments from the crowd on the
Bethesda modding forum.  :)

