
This is the README file for IDBSP10.ZIP - a port of id's BSP builder to DOS.
The package consists of two programs, IDBSP.EXE and WAD_DWD.EXE; source for both
is included.  Be warned that my source is VERY UGLY.  This was literally a
"quick and dirty" port.  But, owing to the efficiency of id's algorithm, the BSP
builder is pretty fast!

Programs were compiled by DJGPP v1.11m5; that's "DJs port of GCC to
DOS" version 1.11 maint 5, which means GCC v2.5.7.  The programs have the DOS
extender (GO32) prepended to them, so no support files (other than EMU387 if you
need coprocessor emulation) are required.

Send comments, requests, etc. to Ron Rossbach at ej070@cleveland.freenet.edu

Thanks to:
	Tom Neff (tneff@panix.com) for developing the WIF format
	Matt Fell (matt.burnett@acebbs.com) for the "Unoffical DOOM specs" v1.3
	Colin Reed (DYL@CIX.COMPULINK.CO.UK) and Raphael Quinet for providing the
			first BSP builder....BSP11x
	DJ Delorie for porting GCC to DOS.
	All the WAD authors and level editor authors out there....keep up the great
			work!
	And of course, John Carmack and the guys at id for releasing the source to
			their BSP builder!

Please use the source code in your own levels editors, utilities, etc.  Please
credit id and myself if you use the code in your programs.  Feel free to
re-distribute this package, as long as you distribute the WHOLE package,
including source and README, and give credit where credit is due.

You may not use these programs or source to create modified levels for the
shareware version of DOOM.

DOOM is a registered trademark of id Software, Inc.

=========
IDBSP.EXE
=========

IDBSP.EXE is a straight port of the NextStep Objective-C source uploaded to
ftp.uwp.edu in April, 1994 by John Carmack of id.  The program takes a DWD
file as input and builds a PWAD file which can then be used with the -file
command line parameter for DOOM.  A DWD file is basically an "ASCII WAD" file;
it is a text file containing descriptions of the vertices, linedefs, sidedefs,
sectors, and things on a level.  IDBSP takes this information and automatically
generates the remaining resources needed for the level - SEGS, SSECTORS, NODES,
REJECT, and BLOCKMAP.

For this port, I've added two extensions to id's original DWD format:

	1) A "level:E?M?" (where ? is the episode and level) directive marks the
		 beginning of each map level.  Multiple levels can be included in a single
		 DWD file.

	2) Any other WAD resource (demos, pictures, etc) is "included" into the DWD
		 file by a directive "resource :size" (note the space between the end of
		 the resource name and the colon), where "resource" is the resource name
		 (like DEMO1, CREDIT, ENDOOM, etc) and size is the total size in bytes
		 the data for the resource will occupy.  When IDBSP encounters this
		 directive, it looks for a file called "resource.lmp" (where resource is
		 the resource name) in the current directory.  It then pulls
		 this file into the PWAD.  No data conversion is performed.  The
		 feature is provided mainly for re-building existing PWADs.  Use DMAUD,
		 DMGRAPH, etc. to perform data conversion.

For more information on the DWD file format, see the WIF spec by Tom Neff
(tneff@panix.com).  IDBSP currently supports id's original DWD format, with
the two extensions listed above.

The command format for IDBSP is:

				IDBSP dwdfile [wadfile]

where "dwdfile" is the name of the DWD file, and "wadfile" is the name of the
PWAD to be created.  If you do not specify "wadfile", TMP.WAD will be created.
If you specify the name of an existing WAD file, IDBSP will ask if you want
to overwrite the file.  If you say no, IDBSP will append the new information
to the existing WAD file.  This lets you build a single PWAD from many DWD
files.

Since I'm new to the DJGPP environment, I'm not sure I got the math coprocessor
emulation right.  The program works with a coprocessor, but I don't have a
machine to test it with the coprocessor emulation library (EMU387).  If you
don't have a coprocess on your machine, and want to give IDBSP a try, you
need to set up an envionment variable called "GO32" to point to the emulation
library.  The command looks like this:

			SET GO32=emu library

where "library" is the path to the EMU387 library.  For example,  EMU387 is
in the C:\GCC\BIN directory on my machine, so I would use the following:

			SET GO32=emu c:\gcc\bin\emu387

I haven't dived completely into the BSP algorithm used by IDBSP, but the
resulting PWAD files are smaller and somewhat faster than those created by
BSP11x.  As Matt Fell said in the specs, this is probably due to id's BSP
algorithm being tuned to generate a BSP tree with the fewest splits, rather than
trying to fully balance the BSP tree.  Also, IDBSP provides automatic building
of the REJECT resource, which will speed up all those line of sight calculations
the DOOM engine does.  BSP11x currently doesn't do this.  Of course, the amount
of speed-up provided by REJECT depends on the level creator using the proper
linedef attributes (like "blocks sound") handle when the monsters are
"activated".

===========
WAD_DWD.EXE
===========

WAD_DWD.EXE is a program which takes a WAD file as input and generates a
corresponding DWD file.  The DWD file can then be used as input to IDBSP.
WAD_DWD is necessary since no available DOOM editors create DWD files on their
own.  For resources other than map levels, WAD_DWD will create a file called
"resource.lmp" where "resource" is the resource name, in the same directory
as the DWD file.  All of these files are input for IDBSP.

The command format for WAD_DWD is:

				WAD_DWD wadfile [dwdfile]

where "wadfile" is the name of the WAD file, and "dwdfile" is the name of the
DWD file to create.  If you do not specify a DWD file, TMP.DWD is created.  All
.LMP files are written to the current directory.

WAD_DWD does not do any floating point math.  If you have problems running it
on a machine without a coprocessor, see the discussion on the emulation library
and GO32 enivornment variable above.

=======================
USING WAD_DWD and IDBSP
=======================

To use WAD_DWD and IDBSP to build your own PWADs, do the following:

1) Use any level editor to create your level, and save to a WAD.  You don't
	 need to have the editor perform any BSP building.

2) Use WAD_DWD to translate the WAD from the level editor to a DWD file.

3) Use IDBSP to create a new WAD from the DWD file containing all BSP
	 information.

You can also re-build complete PWADs supplied by others, but see CAVEATS below.

=======
CAVEATS
=======

There is one limitation to IDBSP and WAD_DWD that I know of:

1)	DEMOs recorded on levels built with another BSP utility (like BSP11x) won't
		work correctly after the level is re-built by IDBSP.  I think this is due to
		some BSP information (related to enemy/player position) being stored in the
		demo file;  obviously this information is invalidated when a different BSP
		algorithm is used.  This is should only be an issue when you re-build
		PWADs supplied by others.

Otherwise, PWADs build with another BSP utility (like BSP11x) re-build fine
with WAD_DWD and IDBSP.  If the PWADs don't include DEMOs, there
are no problems.

To quote John Carmack of id, referring to his BSP builder:

"BTW, there IS a bug in here that can cause up to a four pixel wide
column to be drawn out of order, causing a more distant floor and
ceiling plane to stream farther forward than it should.  You can
sometimes see this on E1M1 looking towards the imp up on the ledge
at the entrance to the zig zag room.  A few pixel wide column of
slime streams down to the right of the walkway.  It takes a bit of
fidgeting with the mouse to find the spot.  If someone out there
tracks it down, let me know..."

I haven't tracked it down, so the bug has been ported with the rest of the
program.  I haven't actually seen the problem on any levels I've built, though.

Please send me an e-mail if you uncover any other problems.  Also, source is
included for those with strong stomachs.  :-)

I hope you enjoy these programs....hopefully they will help with incorporating
complete BSP functionality into the level editors.  Happy DOOMing!
