Tutorial: Setting up a Mod: Addendum Last edited 1 year ago2023-09-26 05:45:36 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
This is an addendum to the original tutorial series, concerning other things to consider for your mod that is not covered in previous articles, and outside the realm of actual mapping, modelling, programming, etc.

Other things you can customize

The general rule of thumb is that you can always omit stuff that you don't want to customize, as the game will read the default files from Half-Life (the valve folder).

Custom music

Whereas WON GoldSrc spins up your physical CD drive looking for the soundtrack, they're included in the Steam version in the media/ folder, comprised of a bunch of mp3 files. Customizing these simply involve adding mp3 files of the same name in the same location in your mod.

TrackerScheme.res

This file defines the UI scheme for GoldSrc's Steam UI, but you can have a custom one for your mod. Things such as UI colours, fonts for various elements, and borders, are defined here.

To customize your mod's UI scheme, copy the original from <Half-Life>/platform/resource/TrackerScheme.res into <Half-Life>/<your_mod_here>/resource/TrackerScheme.res.

The following block, for example, defines the font properties for the game menu.
"MenuLarge"
{
    "1"
    {
        "name"      "Verdana"
        "tall"      "18" // increase this to make menu items larger
        "weight"    "1000"
        "antialias" "0"  // set to 1 to enable anti-aliasing (why wouldn't you want anti-aliased texts?)
    }
}
And the following block defines its colours and metrics:
InGameDesktop
{
    "MenuColor"              "200 200 200 255"
    "ArmedMenuColor"         "255 255 255 255"
    "DepressedMenuColor"     "192 186 80 255"
    "WidescreenBarColor"     "0 0 0 0"
    "MenuItemVisibilityRate" "0.03"  // time it takes for one menu item to appear
    "MenuItemHeight"         "28"   // should be larger than the font size
    "GameMenuInset"          "32"
}

autoexec.cfg

This file is executed at some point in the game initialization, and is a way to have a default command list that is not managed by the game (config.cfg gets overwritten by the game when cvars and keybinds change.)

A common use case for autoexec.cfg is to ensure a certain set of cvars are set as default. For example, if a mod's art style demands the unfiltered pixelated textures look, it can define gl_texturemode with the appropriate value.

Another use case for autoexec.cfg is to define aliases, which is not possible with config.cfg. These are strings of commands you can execute in a single command, and bindable to keys. Aliases prefixed with + or - work as a pair, and used for keybinds (the + alias is executed on key down, the - one on key up). You can use this, and some script-fu, to have, for example, the Ctrl key toggle ducking, or a "bullet time" key.
I used to recommend using userconfig.cfg here but autoexec.cfg is actually the better, and more apt, route for this.

settings.scr and user.scr

Multiplayer Advanced dialog with a custom user.scrMultiplayer Advanced dialog with a custom user.scr
This pair of files is a way of mapping the GUI to cvars in ways not covered by the standard engine GUI. You can, for example, add a checkbox that toggles whether the game ignores textures embedded in maps (r_wadtextures), a text box to set your FOV (default_fov), or a drop down that lets you select between filtered or pixelated textures a-la software mode (gl_texturemode). Do make sure that you add only server cvars to settings.scr, and only client cvars to user.scr.

kbd_act.lst

This file, located in gfx/shell/, is the list of keybindable commands, as seen in the Options > Keyboard dialog. You may want to customize this file to give yourself and other players easier means to bind keys to custom aliases you may have defined in autoexec.cfg.

If your mod has custom code that adds new keybinds, you need to edit this file with the new entries, and ship this file.

commandmenu.txt

A commandmenu in game.A commandmenu in game.
Half-Life and many first-party mods supports commandmenu.txt, though this feature is largely unknown outside of the Counter-Strike community.

You can use this feature, for example, to add a chapter selection menu, change cvars on the fly, or add a dev menu.
However, you'd need to edit gfx/shell/kbd_act.lst and add a keybind option for +commandmenu as per aforementioned.
Protip
If you want to have your menu's command accept a text input (such as entering a map name), set messagemode <command_name> as the command. This also applies to keybinds/aliases described elsewhere on this page.

skill.cfg

This file manages the skill system, defining NPC's health, ammo pickup, and damage dealt. Although it is strongly advised against editing these, it is one way of mod​ifying the balancing of a mod without diving into code.

A Mod, or an Addon Pack? The <game>_addon folder

Steam GoldSrc supports the [over]loading of files without overwriting the base file through the <game>_addon folder. This is also the case for HD and server-downloaded content via the _hd and _downloads suffixes.

Thus, some circumstances where separate mods were required before, might now be a simple drop-in into the valve_addon folder, without the risk of permanently corrupting your game. To disambiguate, lets call the _addon folder use case as an Addon Pack instead of a Mod.

Is my content a Mod or an Addon Pack?
Your content might fit the case of being an Addon Pack if: On the other hand, you must distribute as a Mod if: So, what changed?
An addon pack installs differently to a mod. Firstly you don't need the liblist.gam just to add, say, custom models to Half-Life. Secondly, players can mix and match other things in their games, and they can toggle them on or off (details below), or otherwise jump between vanilla and modded setup quickly.

Other things about addons
To toggle the loading of this folder, go to Options > Video > Enable custom content.

The addon system also works for mods! You can, for example, have addons for Poke646 populating the poke646_addon folder, and toggle them on and off.

The kitchen sink approach of this system is not great (compared to HL2's custom/ folder) but it beats needing to surgically remove files, or reinstalling whole mods and losing saves due to corrupted modifications.

Distributing your mod/addon pack

You have your mod (or an addon pack). You want others to play them. You need to send these files to them. This raises a question: how, where, and which files?

What to [not] include

Firstly, it depends on whether you're distributing your content as a mod or an addon pack.
For mods:
  • liblist.gam (and .dll/.so if using custom code) is required
  • you're free to ship modified versions of titles.txt, sentences.txt, materials.txt, etc.
  • you can have maps share textures in external WADs instead of packing them into the bsp files.
  • custom assets can be organized however seems fit, but do consider how others might want to reuse them for addon packs of their own
For addon packs:
  • mapname.res is required for custom multiplayer maps
  • game files such as titles.txt, sentences.txt, and materials.txt ideally shouldn't be changed
  • packing all custom textures into the BSP means not having to distribute any WAD files
  • organize sounds/models/sprites used in maps into a subfolder (usually the map's name or the author's name). This is strongly endorsed by mods such as Sven Co-op.
For a general release, you wouldn't want to include the working files or file sources (e.g. the PSDs for the textures, or the source code*); only the end products needed for the game engine would suffice. These would be the files with extensions that includes but isn't limited to: bsp, res, mdl, wav, spr, tga, txt, mp3. Use a RES generator to double check that you have didn't miss anything.

For a full source release that includes file sources, consider putting your mod files in a GitHub repository instead.

TL;DR:
Tips on reducing dependencies for addons
  • Compile your map with -wadinclude, so that all textures are baked into the BSP and you don't need to distribute the WADs you used.
  • Use game_text instead of a modified titles.txt
  • For most games/mods, you can employ the 12-character materials hack to have your custom textures sound properly.
Help people contribute to your mod!
  • If your mod contains custom code/entities, include the FGD, sample zoo/tutorial maps in vmf/jmf/bsp, etc.
  • If your mod has a distinct style/setting, include your WADs (and your .rad files too!)

Packing the files

The best practice is to pack the files into a ZIP archive, as most OSes natively support it. Other archive formats would require players to have the associated archiver programs, and the compression improvements are generally insignificant.
No EXEs!
Do not create an installer, as was common in the 00s. Those often made assumptions that has since been obsoleted (e.g. assuming you have WON, or asking for your Steam's email which no longer works after the SteamPipe update), create clutter on people's systems (e.g. desktop icons, entries in "installed programs", and uninstallers, all of which cease to work if you move your Steam library), and generally confuse more than help contemporary players.
For mods:
  1. With the Half-Life directory open, take the folder that contains your mod, and put it into an archive.
  2. Once the archive is created, check that inside the archive is that same folder, and the directory structure is preserved.
  3. If you have working files you wish to exclude, remove them at this stage.
For addon packs:
  1. With the addon folder open, select every file related to your content pack and add them to an archive.
  2. Once the archive is created, check that the archive contains your files and the directory structure is preserved (not flat.)
  3. If you have working files you wish to exclude, remove them at this stage.

Installation

To help would-be players, include a readme file in the archive directing them to extract the archive into the correct installation folder. Also provide them information to verify what a correct installation looks like.
Example install instruction for a mod:
INSTALLATION
1. In your Steam library, right click on Half-Life > Manage > Browse local files.
2. Extract the archive into that folder.
3. After extraction, find the folder <modfolder> inside the folder, which should also have the valve folder.
4. Restart Steam. The new mod should appear in your Steam library list.
Example install instruction for an addon pack:
INSTALLATION
1. In your Steam library, right click on Half-Life > Manage > Browse local files.
2. Inside that folder, create a new folder named "<gamefolder>_addon" if it doesn't already exist.
3. Extract the archive into the <gamefolder>_addon folder.
4. After extraction, you should find <example new file> inside <gamefolder>_addon/<path to new file>.
No overwrites!
Never instruct players to install into valve (or other mods) and overwrite the existing files. You may corrupt their existing games/mods, and when they're done with your stuff (or if your stuff breaks their game) they have no choice but to reinstall the game/mod, and they wouldn't be happy about it.
Test your installation package!
Don't forget to test your package to triple check that you didn't omit any mod assets. Temporarily rename your WIP mod/addon folder, do the installation steps, launch the mod, and load every map.

Hosting the files

There are several places on the Internet that can host your mod/addon files, including: Some of these sites require you to fill a form, so have these information figured out in advance: which brings us to...

Licensing

Note: this is not legal advice. IANAL.

It's the last thing on your mind when you're in the zone. You might assume it'd be one of "here's the files, do whatever" or "credit me if you do stuff with it" and you'll be correct, but the platforms you distribute your mod under has other assumptions, and you may not want to go with the default.

The website https://choosealicense.com/ can help you decide which license you want to distribute your mod under. Then, select the appropriate license type on the hosting website's upload form.

A few pointers: *Some licenses might obligate you include source files; for others, a link to a source repository (e.g. GitHub) would be satisfactory. Read the terms of the license you end up using.

In The End

Congratulations! You've published your mod (or addon pack)!

Hopefully the series has been helpful in assembling and getting your stuff out into the world, for other people to enjoy.

2 Comments

Commented 2 years ago2022-10-16 17:23:53 UTC Comment #104849
I thought the tutorial series needs an addendum as to what other things you might want to set up for your mod; stuff that isn't related to in-game content. Feel free to add whatever I may have missed.

Also it's past midnight and I have to postpone integrating this to the rest of the tutorial's navigation.
Commented 1 year ago2023-02-27 14:46:17 UTC Comment #105137
About the usage of -wadinclude compile command-line argument and game_text entities. I think they are better suited for addon pack where you "can't" edit the original files and copying/pasting the original ones is not an option as if everyone was doing that, it would "overlap".

For mods, shipping the WAD(s) and using titles.txt is fine since it's distributed as "standalone".

You must log in to post a comment. You can login or register a new account.