
Enhanced TreeQBSP
=================

Main features are :

* Very low memory requirements, typically 10-20% of most other compilers.
* Fast processing, partly due to the low memory requirements.
* Large map capacity; most limits are beyond the Quake engine capacity.
* High precision in floating point calculations.
* MultiWAD (WorldCraft-style) and wildcard support.
* Support for default wad file if no other wads found.
* Support for Valve WAD3 format.
* Support for Hipnotic/Ritual entity rotation.
* Support for enhanced texture positioning in QuArK.
* Support for Valve 220 map format, e.g. from Hammer.
* Support for Q2/Q3 map format, e.g. from GtkRadiant.
* Support for floating point coordinates in map files (e.g. from QuArK).
* Enhanced warning/error messages.
* Enhanced leak handling.
* Progress feedback that works in any console and does not cause performance loss.
* Transparent water support.
* Cleanup of texture names.
* No hull files.
* Log file.
* INI file.

==================================================================================================

The changes from the TreeQBSP 1.62 source code are as follows :

TreeQBSP 2.05 (Apr 10 2007)

1. Fixed rare crash bug when calculating MakeFaceEdges.


TreeQBSP 2.04 (Dec 4 2006)

1. Fixed bug when having >32k clipnodes.


TreeQBSP 2.03 (Jul 27 2005)

1. Fixed premature abort/crash bug that occurred when having curly braces or parenthesises in
   texture names.
2. Added coordinates to several portal error messages.


TreeQBSP 2.02 (Mar 10 2005)

1. Increased plane capacity again to avoid compiler sometimes aborting with error message "Internal
   error: numbrushplanes >= cPlanes" due to new hull expansion.


TreeQBSP 2.01 (Feb 12 2005)

1. Improved handling of complex maps such as terrain. This is done by increasing precision when
   identifying unique planes (faces) and modifying hull expansion logic. This reduces the risk of
   clipping errors and creates much smoother clipping hulls which can help player/monster
   movements.

   All maps don't benefit from this, therefore two new options have been introduced; "-oldexpand"
   which just disables the new expansion logic and "-epsilon x" (default 0.01) which sets the
   plane identifying tolerance. To revert to previous compiler behaviour, just add options
   "-oldexpand" and "-epsilon 0.05".

   The default settings have been chosen for overall best results. If you have a big map that
   still doesn't build correctly, you can try lowering the epsilon even more, e.g. 0.001. In most
   maps the default settings have little effect on # clipnodes, but some maps can see either a
   significant increase or decrease. Thanks to Tyrann for this one.
2. Removed option "-altexpand" as it's replaced by the new logic.
3. Increased MAX_FACES (# faces on a brush) from 128 to 512 to accommodate the new hull expansion.
4. Increased plane capacity again to avoid compiler sometimes aborting with error message "Internal
   error: numbrushplanes >= cPlanes" due to new hull expansion.
5. Changed some of the "Brush not closed" warnings into "Too few/many faces in brush" and kept the
   brush if possible.
6. Added coordinates to the "Found a non-convex face" error.
7. Fixed minor bugs in verbose printout handling.


TreeQBSP 2.00 (Oct 1 2004)

1. Changed warning for # faces exceeding normal engine capacity from 64k to 32k.


TreeQBSP 1.99 (Sep 11 2004)

1. Added new option "-q2map" that enables support for Q2/Q3 map file format from editors like
   GtkRadiant. Thanks to Riot for this one.
2. Added automatic healing to point off plane warnings by adjusting the points to the plane.
3. Added error messages for various objects exceeding theoretical bsp limits.
4. Added warnings for various objects exceeding normal engine capacity.


TreeQBSP 1.98 (May 22 2004)

1. Minor improvement of compiling speed for maps that spend a lot of time in the SolidBSP stage.
   Thanks to Tyrann for this one.
2. Added coordinates to the "Face coordinate out of range" error message.


TreeQBSP 1.97 (Apr 23 2004)

1. Added a check for each axial brush forming a closed volume. If a brush is not closed, the bsp
   file might get corrupt and crash the engine.
2. Added error messages for various objects exceeding theoretical bsp limits.
3. Added warnings for various objects exceeding normal engine capacity.
4. Removed the clipnode limit of 32k, but there will still be a warning.


TreeQBSP 1.96 (Mar 8 2004)

1. Fixed a crash bug that occurred when using "-onlyents" with a map without brushes. Bug was
   introduced in 1.90.
2. Added support for wildcard "*" in wad file specifications, e.g. "c:\wads\*.wad".
3. Added new option "-verbosetex" to enable more texture information printout. At this time, it
   will print the wad name for each found texture. Using "-verbose" will also enable this.
4. Added a correction when using Valve 220 format and texture scale 0. It will now be set to 1,
   same as Classic Quake format.
5. Changed some memory printout texts for clarity.


TreeQBSP 1.95 (Feb 18 2004)

1. Added support for Valve WAD3 format.
2. Fixed a bug that in large maps sometimes could produce a crippled leak line.
3. Improved results when using the "-altexpand" option. This sometimes helps reducing # clipnodes,
   getting rid of leaks or clipping errors. Thanks to XP-Cagey for this one.
4. Moved the missing texture handling to the beginning of map processing.
5. Added new option "-nofillvis" which disables filling of hull 0 (the visible hull). This can
   shorten the turnaround time when compiling large maps that spend a lot of time in the hull 0
   SolidBSP stage. Note that no portal (prt) file is generated and the produced bsp may not be
   loadable in the engine.
6. Added new option "-hilimit" to set a special extreme capacity mode. When enabled, some bsp
   format limits (e.g. max # nodes) can be exceeded. Use with caution.
7. Added detection of file seek errors.
8. Restored printout of animating textures if not 0.
9. Changed bsp summary printout for higher capacity.


TreeQBSP 1.94 (Feb 3 2004)

1. Added support for Valve 220 map file format from editors like WorldCraft 3.3 and Hammer.
   However, wads still need to be in WAD2 (standard Q1) format. See also notes below. Thanks to
   Riot for this one.


TreeQBSP 1.93 (Jan 29 2004)

1. Added coordinates to the "New portal was clipped away in CutNodePortals_r" warning message.
   This warning indicates brush misalignments.
2. Minor code cleanup.


TreeQBSP 1.92 (Jan 11 2004)

1. Added new option "-noents" that removes all entities except world and players. This is very
   convenient when dealing with architecture related problems. Recommended together with the
   "-solid" or "-hull #" options.
2. Fixed a bug that sometimes caused incorrect face and brush summary printout.


TreeQBSP 1.91 (Nov 24 2003)

1. Added a warning for different # models in bsp and map when using "-onlyents".


TreeQBSP 1.90 (Sep 18 2003)

1. Increased plane capacity to avoid compiler sometimes aborting with error message "Internal
   error: numbrushplanes >= cPlanes".
2. Fixed a crash bug which occurred when the world wasn't the first entity.
3. Added a check for no entities in map.


TreeQBSP 1.89 (Aug 26 2003)

1. Fixed a crash bug that could occur if using a rotate_object with a target that had no origin
   key. Also, improved information for bad rotate targets and removed repeated printouts.
2. Changed error "Too few faces in brush" into a warning.
3. Changed warnings "No entities in empty space ..." and "No info_player_start ..." into critical
   warnings (always printed).
4. Added line # to the "Multiple info_player_start ..." warning message.


TreeQBSP 1.88 (Jul 29 2003)

1. Added coordinates and texture printout to the "Didn't split the polygon in SubdivideFace ..."
   error message. This error usually means that a texture is scaled too small.


TreeQBSP 1.87 (Jul 15 2003)

1. Improved compiling speed for maps that spend a lot of time in the CSGFaces stage. There is a
   new option "-oldcsg" if you prefer the old method. Thanks to Tyrann for this one.
2. Added new option "-altexpand" that enables an alternative brush expansion method. This might
   help solving some clipping errors. Beware that # clipnodes normally increases. Thanks to Tyrann
   for this one.
3. Reduced memory requirements, typically about 25%.
4. Added new option "-priority #" to set the thread priority 0-2 (below/normal/above, default 1)
   in order to make the compiler more flexible in the Windows environment.
5. Added printout of map title ("message" in worldspawn).
6. Changed warning "No valid wad files ..." into a critical warning (always printed).
7. Improved linearity in the SolidBSP progress feedback.


TreeQBSP 1.86 (Jun 11 2003)

1. Added new option "-numpercent" to select a numerical progress indicator instead of the default
   bars. Note that this only works properly in the operating system console.
2. Removed progress info from the first SolidBSP part.


TreeQBSP 1.85 (May 18 2003)

1. Added new option "-expand #" which makes all brushes expand a selectable distance (recommended
   values are 0.5-2.0). This will have the effect of automatic sealing of tiny gaps that cause
   leaks. However, brush overlaps and therefore compile time will increase. Some texture issues
   may also occur, since the compiler adds new faces that lacks specific texture info.
2. Added new option "-nofillclip" which disables filling of hull 1 (the player clipping hull).
   This can help when having troublesome clipping problems, i.e. the player walking/falling
   through walls/floors. Beware that # clipnodes will increase and may exceed the limit in large
   maps.
3. Added new option "-hull #" that selects which hull (0-2, default 0) that should be made
   visible. This is highly experimental and should only be used for tracking down difficult leaks
   in hulls 1/2 or educational purposes. Look out for HOM effects in hulls 1/2, that might
   indicate clipping errors.
4. Added new option "-percent" to be used after "-quiet".


TreeQBSP 1.84 (May 14 2003)

1. Changed option "-leak #" to select which hull (0-2) to generate a pointfile for. Default value
   is -1, which means any hull. As before, by selecting an invalid hull # (e.g. 3), you might be
   able to force the output of a prt file even if there is a leak.
2. Added new option "-solid" which removes all liquid worldbrushes and treats sky as solid. This
   can be really helpful when hunting for leaks and/or increasing loadability in the engine.
3. Changed error "CheckFace: Face with too few ..." and some of the "Mixed face contents ..."
   errors into warnings.
4. Added new option "-quiet" which just enables "-noverbose -nowarnings -nopercent".


TreeQBSP 1.83 (Apr 3 2003)

1. Improved check for invalid wad files.
2. Added line # to and removed entity information from the "Entity with no valid brushes" error
   message.
3. Added line # to the "No target for rotation entity" warning message.
4. Added new option "-nowarnings" which disables most warning printouts to screen.
5. Added printout of total # warnings.
6. Changed the various verbose options so that log file will always be unaffected by limiting
   options like "-noverbose". Also, "-verbosemem" will now only cause output to log file. This
   makes it possible to have a really compact screen printout but still have all details in the
   log file. Try options "-noverbose -nowarnings -nopercent" and see how it looks.
7. Added filename to general file handling errors messages.


TreeQBSP 1.82 (Mar 11 2003)

1. Fixed a bug where the compiler could generate a bsp with too many clipnodes (max = 32767). This
   could happen when the worldbrush clipnodes were less than the limit, but adding the entity brush
   clipnodes would cause overflow.
2. Added a check for multiple world entities.
3. Added a check for entities with empty "classname" key.
4. Improved line information when checking entities.


TreeQBSP 1.81 (Feb 17 2003)

1. Removed "Total" column from verbose memory summary printout due to overflow risk.


TreeQBSP 1.80 (Nov 15 2002)

1. Fixed a crash bug that could occur if there were no brushes in the worldspawn entity.
2. Fixed a crash bug that could occur if there was an entity without the key "classname".
3. Added a check for too few faces in a brush. Now there must be at least 4 faces in each brush.


TreeQBSP 1.79 (Aug 19 2002)

1. Fixed a bug which caused the compiler to abort if the warning message "... Brush plane with no
   normal" occurred.


TreeQBSP 1.78 (Jul 24 2002)

1. Added map file line information to the error message when exceeding MAX_FACES (128).


TreeQBSP 1.77 (Jul 16 2002)

1. Added automatic sorting of brush faces while loading the map file. The compiler is very
   sensitive to different face ordering so the deterministic sorting has two benefits. The first
   is independence of the editor saving order, especially QuArK has problems with this. The second
   is that the sort order has been chosen in an attempt to minimize error/warnings and to increase
   speed in most maps. There is a new option "-nosortface" to disable this behaviour.
2. Added map file line information to the "Couldn't create brush ..." warning message.
3. Fixed a bug that was causing data corruption when exceeding MAX_FACES (128).


TreeQBSP 1.76 (Jun 25 2002)

1. Improved compiling speed when there are large brushes covering parts of the map (for testing
   purposes). Thanks to Tyrann for this one.


TreeQBSP 1.75 (Jun 14 2002)

1. Fixed a bug in the simplified leak line handling. This seems to cure the problem where the line
   sometimes goes right through solid brushes. The simplification process is now also a lot
   faster. Thanks to Tyrann for this one.
2. Added new option "-simpdist #", which sets the "simplification distance" (default 100) that
   is used when simplifying the leak line. Lower values can make the process faster but the line
   will probably be longer.


TreeQBSP 1.74 (Jun 6 2002)

1. Added new option "-fill", which will force filling in hulls 1/2 when there are leaks. This is
   very useful in large maps when the leaks cause the max # clipnodes (32767) limit to be exceeded
   which aborts the compile. The forced filling will probably cause the player and most other
   entities to be stuck when loading the map in Quake. Use noclip to move around and find the
   leaks by loading the pointfile.
2. Changed logic of the simplified leak line. This results in a slightly longer leak line but the
   position of the hull breach is more precise and the process is faster.
3. Increased the default value for the distance between dots in pointfiles from 2 to 4. This cuts
   the total # dots in half while still maintaining a visible trail.
4. Added validation of the "-leakdist" option value.
5. Added a progress bar to leak line simplification when it's lengthy.


TreeQBSP 1.73 (May 21 2002)

1. Fixed a bug that caused bsp corruption when using option "-onlyents" (only update entities).
2. Added check to prevent using a sourcefile with the extension ".bsp".


TreeQBSP 1.72 (May 8 2002)

1. Added support for enhanced texture positioning in QuArK. The standard format is still
   automatically supported. If you are using QuArK and don't want the new support, it can be
   disabled with a new option "-oldtexpos". See also notes below.


TreeQBSP 1.71 (Apr 15 2002)

1. Increased MAXEDGES from 32 to 64. This allows more complex brush arrangements in the map.


TreeQBSP 1.70 (Mar 4 2002)

1. Increased floating point precision from float (32-bit) to double (64-bit). This helps avoiding
   problems in some maps and improves tjunction calculations.
2. Due to the increased precision, memory requirements nearly doubled. To compensate for this,
   another reduction was made and requirements are now about the same as before.
3. Changed hull file handling. If they exist at startup, they will be removed to avoid confusion.
4. Removed option "-noclip" as it didn't work anyway.


TreeQBSP 1.69 (Feb 14 2002)

1. Reduced memory requirements, in some situations up to 40%.
2. Doubled map file loading speed.
3. Increased MAXTOKEN (size of a token string in the map file) from 256 to 1024.
4. Added new option "-verbosemem" to enable extra memory printout without extra map info.
5. Changed verbose memory summary printout slightly.


TreeQBSP 1.68 (Jan 29 2002)

1. Fixed a bug where the prt file was generated twice. Also changed the Portalize printout
   slightly.
2. Added coordinates to the "Face with too few points ..." error message.
3. Added # faces and texture (max 4 unique) printout to the "Couldn't create brush faces" warning
   message.
4. Changed prt file handling so vis portals between adjacent sky brushes are only generated when
   option "-transsky" is used (not recommended).
5. Fixed a small memory leak.
6. Minor adjustments to handle larger values in printouts of big maps.


TreeQBSP 1.67 (Jan 14 2002)

1. Increased MAX_HULL_POINTS from 64 to 512 and MAX_HULL_EDGES from 128 to 1024. In some maps you
   could get a "Internal error: num_hull_points ..." message which aborted the compilation.
2. Fixed a bug in the MakeFaceEdges calculations. In some maps you could get a "Internal error:
   map.rgEntities[map.iEntities].iVertices ..." message which aborted the compilation.
3. Added simple progress bars to calculation intensive parts. The bars display one character for
   each 10% completed and the positions for 50% and 100% are marked with a '+', i.e. "----+----+".
4. Added handling of a default wad file. If no wad files are specified or none can be found, then
   a wad file with the same name in the same directory as the map file will be used.
5. Added face contents printout to the "Mixed face contents" error message.
6. Added entity printout to the "Entity with no valid brushes" error message.
7. Added check for too long texture names in map file.
8. Restored the defaults for the "-nopercent" option due to the new progress bars.
9. Fixed bugs in general path name handling.
10.Fixed bugs in the _wad/wad key handling.
11.Changed coordinate printouts slightly.
12.Improved internal error handling slightly.


TreeQBSP 1.66 (Jan 2 2002)

1. Added entity classname to the leak printout (e.g. "item_shells").
2. Fixed a bug in memory summary calculations and changed printout slightly.
3. Fixed a bug in printout of "Degenerate edge" error and turned it into a warning.
4. Changed elapsed time printout slightly.


TreeQBSP 1.65 (Dec 13 2001)

1. Added new option "-leak #" (default 1) to select which leak to generate a pointfile for. Note
   that when using an invalid leak # (e.g. 0), you might be able to force the output of a prt
   file even if there is a leak. The Vis process will probably be substantially extended in this
   case.
2. Improved handling of texture names when used in mixed upper/lower case in map/wad files or when
   there are ending garbage characters in wad files. This probably covers the undocumented changes
   made between version 1.62 to 1.63. Thanks to Maddes at Quake Info Pool
   (http://www.inside3d.com) for this one.
3. Reversed the defaults for the "-tjunc" option. Now you must add "-notjunc" to disable tjunction
   calculations. Most people will want to keep it enabled, since it can significantly reduce the
   "sparkle" effect between brushes in GLQuake. Enter "gl_clear 1" in the GLQuake console, move
   around in the map and look at the walls to more easily see this effect.
4. Fixed log file so it flushes to disk while running.
5. Fixed a small memory leak.
6. Fixed a file handle leak.
7. Fixed a bug in the printout of the por file name.


TreeQBSP 1.64 (Dec 4 2001)

1. Added support for floating point values in map files. This makes it very usable in QuArK as an
   alternative to TxQBSP, especially for low-end systems. However, there is no support for the
   enhanced texture positioning scheme used in QuArK. Also note that TreeQBSP still handles
   normal integer map files if you use another editor.
2. Improved handling of pointfiles when there are leaks in different/several hulls.
3. Improved speed of leak line simplification ("new style") and added a descriptive message.
4. Improved display output in the QuArK console so it updates while running.
5. Fixed a bug in the por file (alternate pointfile for BSP editor) generation.
6. Fixed a bug in the "-subdivide" option handling.
7. Fixed a bug in map file line counter (used in warning/error messages).
8. Added the VC compiler switch /Op ("Improve floating point consistency") which eliminates the
   differences in results that otherwise occur between debug and release version of the TreeQBSP
   program. This is a rather significant matter, since one of the points with QuArK seems to be
   improved precision in calculations. Unfortunately, this disables some optimization and makes
   the program slower (~20-30%). Better slow than sorry ...
9. Reversed the defaults for the "-nopercent" option. Now you must add "-percent" to enable
   percent completion information.
10.Improved visual information for several warnings/errors.

==================================================================================================

Note : TreeQBSP behaves slightly different than other QBSP variants. To make it behave more like
       the others, the following command line can be used :
      
       qbsp -oldaxis -oldleak [mapname]

       In most cases, the new style leak line (default) is considerably easier to follow in Quake,
       but if it doesn't seem correct (e.g. the line goes right through solid brushes) you might
       want to try the old style line. You can always use the "-leakdist #" option to reduce the
       amount of dots in pointfiles. If Quake cannot load the entire pointfile, use the Quake
       command line option "-particles #" to increase the capacity.

       Also, transparent water is not default (like in TxQBSP), but can be enabled via the
       "-transwater" option. Beware of the performance hit in some maps.

       Some lighting problems might occur when using most light tools together with a compiler
       that supports enhanced texture positioning (e.g. QuArK ETP or Valve 220 Hammer). Light 1.27
       and TyrLite 0.94 (see Tyrann's site below) or later versions support ETP.

==================================================================================================

Original QBSP source code by John Carmack,              http://www.idsoftware.com
TreeQBSP 1.62 source code by Greg Lewis,                http://toronto.yossman.net/~tree
Several modifications inspired by Armin Rigo's TxQBSP,  http://www.planetquake.com/quark
and Tyrann's TyrQBSP,                                   http://disenchant.net
Valve and Q2/Q3 support inspired by Riot's DuBSP,       http://www.orbiter-productions.com/alchemy
Alternate clip hull generation inspired by XP-Cagey,    http://www.xp-cagey.com

