cutAlpha - BETA 0.5

2016, Alias Conrad Coldwood

Introduction

This command-line tool exports static level geometry of most Build Engine maps to iD Software's Quake maps. There's currently no support for actors or entities, little support for textures, and no brush optimization.

Don't expect to be able to convert, compile and play. It just won't work.

But it will generate a geometry that is accurate enough that you can use it as a base to port your levels. Also, be advised that this is a BETA release and some features might change in the future, or be removed altogether.

I'm throwing in the (very dirty) source code.

Commands

Every command has a shorthand, which is composed of the capital letters of the long command. For instance, The short hand for "-SKip" is "-SK". Also note that commands are case-insensitive.

-Replace

By default, cutAlpha will ask you what to do when a file already exists. When enabled, this option will force cutAlpha to always replace existing files, without asking you first.

-Group file

By default, cutAlpha will search for files readily available on the drive. This options allows you to specify an alternate location for grouped files, so if a requested file cannot be found cutAlpha will browse the content of the group to find it. This option is particuarly useful when dealing with custom ART files. All GRP files (most Build games) and RFF version 2 and 3 (Blood) are supported. Note that Powerslave's STUFF.DAT is actually a GRP file with a different extension.

-Input file

The source Build Engine map file. Most formats are suppored (see list of supported formats for more info).

-Output file

The destination Quake map file.

-Integer

By default, cutAlpha will write the destination MAP file using floating point values (decimals numbers), while this behavior produces a much better result, it's not supported by every version of QBSP. This option allows you to force cutAlpha to convert all values to integer first. Please be advised there's no correction in the rounding process, which will likely cause leaks (holes in the map).

-Scale xy z

Rescale factor, applied on top of the hard-coded rescale factor (x: 1/16, y: -1/16, z: -1/128). Two values above 0 (X and Y uses the same value, Z uses an independant scaling).

-SKip element

Elements that should be skipped during conversion. Can either be "floor", "ceiling" or "wall" (this parameter can be used multiple times). This option is pretty handy if you plan to port your map by recreating brushes manually (which would produce a much better result, and might be required for some games).

-Quake1

Output a Quake I map file (should also be the format used for Half-Life). In Quake II maps, three extra fields are added for each plane: SurfaceFlag, ContentFlag and MultiPurposeValue. These fields aren't supported by Quake I. Note that output maps should be fully compatible with Quake-based games such as Soldier of Fortune, Heavy Metal Fakk 2, SiN, Kingpin, Return To Castle Wolfenstein, etc.

-TexFolder directory

This value is used when writing the map file, it's meant to tell QBSP and Radiant where textures are located (it's relative to the "textures" directory, located in the base/mod folder of the game). cutAlpha doesn't rely on this information, unless -TexExtract is also specified (in which case the specified directory becomes the destination directory for the extracted textures)

-TexCaulk file

This value is used when writing the map file, cutAlpha doesn't rely on this information. The caulk texture is used to cover faces that aren't visible, or faces that were created by the conversion process. By default "common/caulk" is used.

-TexExtractTGA srcPal
-TexExtractWAD3 srcPal
-TexExtractWAL srcPal dstPal
-TexExtractMIP srcPal dstPal
-TexExtractWAD2 srcPal dstPal

Extract textures from TILES###.ART (those files must either be located in the working directory or inside a group file) and convert them to TGA (Kingpin), WAD3 (Half-Life), WAL (Quake 2), MIP or WAD2 (Quake). srcPal is the source game palette (required since ART files don't store that information): that file will be PALETTE.DAT in most cases (Duke Nukem 3D, Shadow Warrior, ...) or BLOOD.PAL for Blood (note that ACT files are also supported). dstPal is the target game palette, it's required by some formats (WAL, MIP, WAD2), but not by others (TGA, WAD3). Texture containers (WAD files) will use the name specified by -TexFolder, while stand alone files (TGA, WAL, MIP) will be stored inside a brand new directory named after -TexFolder. If none of these parameters are used, textures won't be converted.

-WallThickness value

A value between 32 and 2048 to define wall thickness, in Build units.

-InRange x1 y1 x2 y2

By default, cutAlpha will convert every sector of the map. This option allows you to choose which sectors should be converted by providing an area (coordinates are in Build units). Only sectors located inside the defined rectangle (even partially) will be converted.

-Debug level

At level 1, a log file is written (or expanded) during execution, it contains everything shown during the conversion process. At level 2, more info is added (mostly loop iteration). At level 3, even more stuff is shown (the result of certain functions). By default, the debug level is 0 (standard information, no log)

Supported Formats

Most of Ken Silverman's Build map versions are supported (specifically version 3 to 7), it covers famous games such as Duke Nukem 3D, Redneck Rampage and Shadow Warrior, and more obscure titles such as TekWar and Powerslave. Monolith's custom Blood map format version 6.00 (used in the alpha leak), 6.03 (demo) and 7.0 (retail) are also supported:

Legend of the Seven Paladins 3D (aka. Rock'n Shaolin)v4Sep 1994Accend Incorporated
Duke Nukem 3D beta (aka. Lame Duke)v53D Realms
Witchavenv6Jul 1995Capstone Software
William Shatner's TekWarv6Aug 1995Capstone Software
Duke Nukem 3Dv7Jan 19963D Realms
Witchaven IIv7May 1996Capstone Software
Fatev7DogBone Software
Powerslave (aka. Exhumed)v6Dec 1996Lobotomy Software
Redneck Rampagev7Apr 1997Xatrix Entertainment
Bloodv7.0May 1997Monolith Productions
Shadow Warriorv7May 19973D Realms
Namv7Jun 1998GT Interactive Software
Extreme Paintbrawlv7Sep 1998Creative Carnage
World War II GIv7Jul 1999TNT Team

The program is able to output two different map format: Quake (also used by Half-Life) or Quake II (also compatible with Quake III Arena and games using either the Quake II or III engine, such as Kingpin, SiN, Soldier of Fortune, etc)

Wishlist

Brush optimization (removing shading sectors, do not cut out inner loops located above the ground level / under the ceiling level).

Better integer approximation.

Proper texture support would be huge.

Release file specifications for all supported Build formats and Quake.

What's new

beta .2

beta .3

beta .4

beta .5

Error and warnings

getWallBefore:: failed to find wall[#]'s preceding wall

getWallAfter:: failed to find wall[#]'s following wall

When creating solid walls, cutAlpha will search for the adjacent solid walls. This error is thrown when the preceding or following solid wall wasn't found. This message is a warning.

Sector2Area:: sector[#] corrupted, expected wall # to #, found #

Sectors' walls are defined using a starting point (a wall index in the walls table) and a count (how many walls belong to that sector). On rare occasions, the wall index retrieved for a sector is located outside the range of walls that should be allocated to that sector. When such a thing happen, cutAlpha will close the most recent loop automatically. This message is a warning.

Sector2Area:: failed to merge innerLoop[#] to sector[#]

This is a What The FUCK?! kind of error. Inner loops are supposedly all contained inside the main sector, which means that the inner loop should always be able to connect to the outer loop by tracing a ray going to the right. Sometimes, that doesn't happen, which means the loop that belongs to this sector is (at least partially) located outside the sector.

Sector2Area:: sector[#] is too small to process

This warning is thrown when there's nothing left of the sector after removing its co-linear walls, overlaping points, and overlaping segments.

writeQuakeMap:: no area to write

This error is thrown when no information is available to write the target map. This could happen if you have a Build map made of one unique and very narrow sector; or if you skipped the generation of all floors, walls and ceilings.

areaClip:: failed to clip sector[#]

cutAlpha converts sectors into one or more convex shapes by projecting a ray from the edge of a wall that is forming an angle going "away" from the sector. It is expected that the ray will cut the shape in two parts, and both chunks are valid shapes. Sometimes, every attempt at cutting the shape failed, resulting in that error. Maybe the sector has two (or more) inner loops intersecting one another, or two (or more) walls of that sector intersect, forming a bowtie.

Faq

Q: Why do I get the message "FloatPlane: Bad Normal" after compilation?

A: Most likely, QBSP doesn't support floating point values, try converting the map again with "-accuracy integer".

Q: Why do I get the message "bounds out of range" after compilation?

A: Either a brush is located too far away from the origin of the coordinate system (try recentering the map to point 0, 0, 0); or the brush is too big to be processed (which can happen with large outdoor areas, or very long tunnels, there's no quick workaround for this: you'll have to shorten the section manually).

Q: Why do I get the message "leaked" after compilation?

A: Either a specific type of door wasn't converted as expected, or the rounding of decimal values created a gap between brushes. The way sectors are broken down in brushes right now isn't kind to QBSP. I need a better algorithm for that (turning shapes into triangles could work much better)

Q: What are the worst maps to convert?

A: Most bugs in the conversion originated from unexpected Build map tricks. Blood's BB1 and BB2 caused some headache until I figured out the two corrupted sectors were part of Shade's signature. I also had troubles with E1M4: walls in sector 191 (the underwater section on the far left of the map) are not ordered as I expected (outline walls are numbered: 1353, 1366, 1367, and 1368). Sector 368 in Duke Nukem 3D's E4L1 (the kitchen near the mess hall) provides one inner loop before the sector outline, which I also didn't expect. Tekwar is a mess, some loops are not closed properly and instead propagates to other sectors, going far beyond the wallNum count (and subsequently caused the program to crash). Sector 573 in CITY1 and CITY3 (TekWar) is broken in two different loops, even though both loops are clockwise and sharing a wall (so they should in theory be divided in two sectors -- it doesn't make sense to me). There are also a few wall overlapping (see sector 731 in Level2, upper right corner of the map). There was no issue with Powerslave, but I still have to test Witchaven and Redneck Rampage.

Contact

Mail: aliasconradcoldwood@gmail.com

Site: http://gaarabis.free.fr/