Valve Developer Union

Features of Modern Quake Source Ports

(May 24, 2018)


In 1999, John Carmack released the source code to Quake for reuse under the GPL license. With it, fans of the game have continued to update the game with bugfixes and new features for the convenience of people still making levels for the game. Each source port adds a different set of features and has different capabilities to others. Nowadays, it's strongly recommended that you use a source port, even if you don't plan on modding the game.

What is a source port?

A source port (also known as an engine) is a fork of the source code of a game meant to fix compatibility issues, port the game to other platforms, and add features that were not present in the original. (Technically, the id-made Winquake and GLQuake clients are source ports, as one ports the game to Windows 95, and the other adds OpenGL support.) These begin to crop up when the source code to a game is released for reuse and modification. Most prominent are the source ports for id Software's games, such as Doom and Quake.

Info

Are source ports legal?

Source ports are 100% legal as long as they don't come with the game's assets. This means a source port still requires an original copy of the game bought through retail, on Steam, or on GOG to function. id's code is also released under the terms of the GNU General Public License (GPL), and all source ports must be released under the same terms as per the license.

In this guide, we'll be focusing on Fitzquake-derived source ports, the major two being Quakespasm and Mark V. These are the most commonly used among Q1SP fans and modders today. Other source ports, such as FTE and Darkplaces, are less faithful to the original game and aren't as commonly used.

Installing a source port

An example of how to install a source port
An example of how to install a source port

Installing a source port is incredibly easy, and doesn't require much installation or setup. Simply put: drop the source port into the folder where your id1 directory resides and run it. On startup, the source port will look for that folder, along with the PAK0.pak and PAK1.pak files inside id1. If it can find those, the game will start up. The source port and the original game executable can exist in the same folder, as long as id1 is visible to both of them.

Common features of source ports

The rest of this guide will demonstrate some of the features often found in source ports. Both Mark V and Quakespasm have all of these.

Increased engine limits

Both the original game and the BSP format itself have internal limits that prevent especially heavy, detailed maps from running. Mappers commonly hit these, and one of the first things source ports often do is raise these limits or get rid of them entirely. Quakespasm is notable for being able to run nearly every Quake level ever released, and Mark V isn't far behind, with Ter Shibboleth, an episode that requires its own network protocol, being the only one to trip Mark V up.

Ter Shibboleth's shib3, demonstrating the massively increased engine limits of modern Quake engines
Ter Shibboleth's shib3, demonstrating the massively increased engine limits of modern Quake engines

This is why it's often a good idea to upgrade to a source port, even if you don't plan on making levels; the original DOSQuake, WinQuake, and GLQuake executables are simply incapable of running most modern mods and maps. All of the pack-in Arcane Dimensions maps require a source port, for instance.

Some source ports also support the loading of BSP2 files, which have extremely high limits, far higher than traditional BSP files. If your map hits the limits of the BSP format, you can set your compiler to output a BSP2 file instead. All modern engines support loading these.

Colored lighting

Modern compilers, if they detect colored lighting in a level, will output a LIT file alongside the BSP. Source ports will load and render this file instead of the normal greyscale lightmaps found in the BSP itself. To add color to a light, add the _color keyvalue to it and set three values, the red, green, and blue (RGB) of the light. _color 255 255 255 is the default, which is snow white. Unlike GoldSrc or Source, the brightness of the light is still set using the light keyvalue. It's strongly recommended that the color you use is light and almost pastel in tone; otherwise, you can oversaturate your lighting and get strange artifacts and visually unappealing results.

Ogre Bastille by Simon O'Callaghan, demonstrating colored lighting
Ogre Bastille by Simon O'Callaghan, demonstrating colored lighting

You can check lightmaps in a GL or DirectX source port using the r_lightmap console variable. This is equivalent to gl_fullbright 2 in Source games; all textures will be replaced with plain white, leaving only lighting information. The shot above, of Simon O'Callaghan's ad_e2m2 map, shows his subtle use of colored lighting with the r_lightmap command.

Fog

Rudimentary fogging is available to maps using both the fog keyvalue in worldspawn and the fog variable in the console. The density and color of the fog can be changed using the parameters of both the keyvalue and the variable. (Outside of mods, there's no way to change fog values after the map loads using a trigger or any kind of scripting, hence the use of the word "rudimentary".)

To add fog to a level, first experiment using the following console variable:

fog [density, 0-1] [red, 0-255 or 0-1] [green, 0-255 or 0-1] [blue, 0-255 or 0-1]

The first value, density, is a float value, and you'll want to set it in very minute amounts. Try a value of 0.01 at first and increase as necessary. The color values can all be set using RGB or float values, like setting light color in the Quake II engine. We recommend you use float values; RGB has a tendency to bleach out traditional "rolling" sky textures. To convert RGB to float, divide the RGB value by 255, and to convert the other way around, multiply by 255. After you're satisfied with your fog, you can transfer the values to the worldspawn entity using the fog keyvalue.

The Mire by ionous, demonstrating fog
The Mire by ionous, demonstrating fog

ionous' ad_dm5 uses a fog value of 0.05 0.3 0.34 0.25.

Alpha-masked textures

Brush entities can be made transparent by adding an alpha keyvalue. It takes a float value between 0 and 1, with 0 being invisible and 1 being opaque. While this won't let you create breakable glass (that still requires a mod), you can at least get the appearance of glass with it.

Glass created using a func_wall with an alpha keyvalue
Glass created using a func_wall with an alpha keyvalue

If you need per-pixel transparency on a texture, modern source ports support this as well. Any textures that begin with the open curled bracket ({) will render with their solid black pixels (0 0 0) transparent when applied to a brush entity, such as func_wall or func_illusionary. ad_tfuma, by FifthElephant and ericw, uses this frequently for grate textures.

Terror Fuma by FifthElephant and ericw, demonstrating alpha-masked textures
Terror Fuma by FifthElephant and ericw, demonstrating alpha-masked textures

Skyboxes

Initially, Quake was limited to warping, "rolling" sky textures, as seen in the base game. Nowadays, though, Quake levels can take advantage of proper, six-sided skyboxes, like in Quake II, GoldSrc, and Source games. Arcane Dimensions' main start map uses this to great effect, with a large moon and cloud cover visible above the level.

Arcane Dimensions' start map, demonstrating skyboxes
Arcane Dimensions' start map, demonstrating skyboxes

To use a skybox, apply one of the rolling sky textures as normal, but specify the name of the skybox to use in worldspawn using the sky keyvalue. The game will load this skybox instead of the rolling sky, provided it can find it in the files. As for your skybox textures, you should have six of them, they should be in TGA format, and be placed in the [mod]/gfx/env folder (id1/gfx/env, ad/gfx/env, etc.) and suffixed with up, dn, lf, rt, ft, and bk. You do not specify these suffixes in the sky keyvalue, only what's before it. If your sides are named moonrise_dn, moonrise_up, moonrise_lf, and so on, you'd specify the sky name as moonrise_ in worldspawn.

The process is identical to the process of making custom GoldSrc skies, as seen in our "Custom 2D Skyboxes and the light_environment Entity" guide.

External textures

Quake's original color palette is notoriously limited, and while WAD textures are forever limited to it, externally-loaded textures are not. If you need more colors, you can have the game load in external TGA files by placing them in the textures directory of your mod. ad/textures features a large selection of plant and spider web textures, for instance, and these can use the full 24-bit color spectrum. For transparency in external textures, you can simply make the TGA files transparent in your image editor, and they'll load as transparent in-game.

{vinehang2b.tga from the Arcane Dimensions files The Forgotten Sepulcher by Giftmacher and Simon O'Callaghan, demonstrating external textures
Left: {vinehang2b.tga from the Arcane Dimensions files
Right: The Forgotten Sepulcher by Giftmacher and Simon O'Callaghan, demonstrating external textures

You should still have fallback textures handy in case the external textures don't load. Though ericw-tools has a switch for not packing any fallback textures into the BSP, this is not recommended.

Keep in mind compatibility if you use any of these features; they may not work identically in all engines, and they might not work at all in some. WinQuake and GLQuake support none of these, for instance, so if you're looking to remain compatible with the original game, keep this in mind when planning out your level.