Welcome, Guest! Login | Register

How to Make a Half-Life Modification [Print this Article]
Posted by: EarthQuake
Date posted: May 17 2003
User Rating: 4.8 out of 5.0
Number of views: 13827
Number of comments: 0
Description: An extensive guide everyone will enjoy!
How to Make a Half-Life Modification by EarthQuake

This guide is intended for everyone, so you don't have to be a rocket scientist (or omega) to understand this stuff. I do, however, require that you be familiar with Half-Life. So, that obviously means that if you've never played Half-Life, then making a Half-Life mod isn't for you. Everyone wants to make a mod, and I'll try to explain every bit I can, but first you must consider a few things:
  • Originality - No one wants to play a counterstrike clone. If you were planning a mod like this, then I would suggest quiting now before you get ahead of yourself, because about 99% of all counterstrike look-a-likes I've seen, have been in "developement" for three or more years, and have not progressed any. Mods based off movies are another bad choice for a Half-Life mod for specific reasons I won't get into. Although I don't support mods like this, I will admit that I have seen a successful few that did finally make it to the public.
  • Leadership - If you do not have a clue at what you are doing, or if you cannot keep everyone updated on what everyone else is doing, chances are, you won't have a team for much longer. You need to be able to keep everyone in check, and make sure the others know what they are to do. This requires a bit of organization and mercy. Yes, I said mercy. If you slave your team members to death, and just pile them with loads of work, you'll poop em out, or just flat out frustrate them.
  • Determination - About 90% of all mods never make it to the main street. The mod leaders gave up on it, or left their development team stranded. If you can't show interest in your own mod after two months of working on it, then you made a bad decision to start it in the first place. Determination is the key to getting the mod done. I mentioned above that you should never overwhelm your team, but sometime you have that one member that likes to procrastinate. Keep reminding everyone of their goal, so that everyone keeps working.
  • Talent - Before you can make the mod, you must have those to help you do it... (unless you're omega) Usually, you'll have one person doing a specific job, but sometimes if you are very lucky, you'll find that gifted human that can code, map, and model -- all in one! But don't count on it. Last, but definitely not least: Do some of the work yourself! If everyone is working their asses off, and the only thing you do is "design and playtest", then others will feel like they are taken advantage of, and likely leave your mod. Share the load, even with yourself.

Directory Structure

Now that I'm done ranting, I'll start explaining the concepts of making a custom mod and what is actually inside the mod. All Half-Life mods have their own folder in Half-Life's main directory. All of the files I will be talking about (unless otherwise specified) will be in this root directory. Inside each mod folder, are subdirectories for specific types of files:

cl_dlls - contains the client-side code library
dlls - contains the server-side code libraries
events - contains the event placeholders (content inside each .sc file is ignored)
gfx - contains graphics for the Half-Life launcher shell and map skies
maps - contains the maps and stores the nodegraphs
media - contains the animated logos and launcher sounds
models - contains the models
overviews - contains the overviews for the maps
save - stores the saved game files
sound - contains any sounds used in the game
sprites - contains special effect sprites and sprites for the heads-up-display

You only require to have a subdirectory, if you have something to put into it. The rest of the files, like the configuration files, and graphic .wads, go into the modification's root directory. I'll go into more detail as we go along, but for now, I'm going to concentrate on probably your most important file, the liblist.gam. Without this, the modification won't even show up in the Custom Game menu. It is a simple ASCII text file that has certain "keys and values". Each line has one "key" and one "value" that tells Half-Life about how to display and use your mod. Here is what one looks like:

 CODE  
// comments are preceded with a double forward slash
// all comments are ignored by Half-Life

game "Mod Name"
gamedir "moddir"
url_info "www.mymod.com"
url_dl "www.mymod.com/downloads"
version "1.0"
size "512000"
svonly "0"
cldll "0"
type "multiplayer_only"
hlversion "1110"
nomodels "0"
mpentity "info_player_start"
gamedll "..\valve\dlls\hl.dll"
startmap "map01"
trainmap "train01"


You may copy the above and put it into your own liblist.gam file.
This file can really let you customize the way your mod appears, and is also vital to getting your mod playable. Okay, so here's what all that stuff above means:

game - This tells Half-Life what the name of your mod is. The text you enter is exactly how it will apear in the Custom Game menu, so use make sure you spell and capitalize everything right.
gamedir - This tell Half-Life what folder it should look in for you mod.
url_info - This points to the mods website.
url_dl - Stands for URL download. This is the download location (not file) for your mod.
version - This is the version/revision number of your mod. Any values will work.
size - This is the size of your mod folder contents in bytes.
svonly - This is a yes/no key that tells Half-Life if your modification is server-side only. 0 is false and 1 is true. Most mods are not server-side only.
cldll - This is a yes/no key that tells Half-Life if your mod uses a modified client.dll. 0 is false and 1 is true.
type - There are no official standards to what can go here, but however, typing "multiplayer_only" will disable the singleplayer-oriented buttons in the Launcher shell.
hlversion - This forces the users to require a certain version of Half-Life to play the mod.
nomodels - This will disable the model selection box in the Customize menu. 0 is false and 1 is true.
mpentity - This is another important key that tells Half-Life what maps to add to your mod's map selection box. The value of this key is the name of the entity that must be present in a map, for that map to be visible in your mod.
gamedll - This is the path of the main game library. If you do not have a modified game .dll, then you should refer to Half-Life's hl.dll.
startmap - This is the map that will run when you start a singleplayer game. This key should not include ".bsp" in the value. Leave blank, and the original Half-Life levels will run.
trainmap - This is the training map that will run in a singleplayer game. This key should not include ".bsp" in the value. Leave blank and the original Hazard Course will run.


Configuration Files


There are just a few configuration files... but enough to forget what they do. All .cfg files go into the modification's root directory. Here's a list of the common ones:

config.cfg - Generated file containing the user's configuration such as the player's name, the video mode, the key bindings, etc...
default.cfg - Contains the default configuration for when the user clicks Use Defaults in the Controls menu.
game.cfg - This is the file generated by Half-Life to store variables the the user has set, such as the frag limit, realistic falling damage, etc...
server.cfg - This is the file generated by Half-Life to store variables for multiplayer dedicated games.
skill.cfg - This is the easiest way to change the difficulty of the game. This file lists all monsters and their health/attack damage for each of the three skill levels. It also lists the player weapon damages and player damage adjusters. However, some of these values do not accurately reflect in the game, so this should be a last resort.

You can include other configuration files in your mod, and execute them through the console by typing "exec myconfig.cfg". In conjuction with new code, you could perhaps have .cfg's load for certain maps or game modes. You can set any control variable in a .cfg, and there are also a few other commands to make the .cfg's do special things.


Option Scripts


You can customize the way that the Advanced Option menus display entries by altering the settings.scr and user.scr files. These files use a special script, which I'm about to explain.

Each file consists of a list of cvars (control variables), from which you can add or remove. There are two different option scripts: the settings.scr which can only have server/multiplayer cvars, and user.scr which can contain client cvars. The format of both scripts is similar to the following:

 CODE  
//Comments are ignored just like in the liblist.gam.
VERSION 1.0
DESCRIPTION SERVER_OPTIONS  
{
    "mp_timelimit"      //cvar name
    {
  "Time Limit (Min.)"   //in-game description
  { NUMBER 0.000000 -1.000000 }  //cvar type, min value, max value
  { 30.000000 }    //default value
    }

    "mp_allowmonsters"    //cvar name
    {
  "Enable Monsters"     //in-game description
  { BOOL }    //cvar type
  { 0.000000 }    //default value
    }

    "mp_falldamage"    //cvar name
    {
  "Falling Damage"      //in-game description
  {
    LIST    //cvar type
    "Normal" "0"    //description, index
    "Realistic" "1"     //description, index
  }
  { "1.000000" }    //default value
    }
}


Depending on which file you are modifying, you must be sure to type the right description of the file. The above is an example of the settings.scr, and the line that says "DESCRIPTION SERVER_OPTIONS" tells Half-Life that it is indeed the settings.scr. If this was the user.scr, then that same line would read "DESCRIPTION INFO_OPTIONS". Just keep in mind that you cannot put server cvars in user.scr because when you, the client, join a server, the commands you specified will be overridden by the server.cfg on the machine you are connecting to.

There are four different ways to display cvars in the Options menu:

1. Boolean (BOOL) - This is for cvars that only have two values, 1 and 0.
2. Number (NUMBER) - This is for a range of user specified values. You must remember to specify the minimun and maximum values as well. (-1 represents no limit)
3. String (STRING) - This is for specifying something such as a map, model, or name.
4. List (LIST) - This is for giving the user a selection of values. See above for how to do this.


Mapcycle & Message of the Day


If you have a multiplayer dedicated server running your mod, you may wish to use these files. The mapcycle.txt holds a list of all the maps that you would like to load after the time limit is over. Each line has the filename of a map (without the extension), and when one map is over, the map, in the next line, will load. If one of the maps you entered doesn't exist, then Half-Life will just go to the next one in que. Once Half-Life reaches the bottom of the list, the cycle will start from the top.

The motd.txt, which stands for "message of the day" is a text file that is displayed to anyone who joins your server. This text file could contain information like your server name, mod website, who to contact in case of cheating, or server rules.


Materials.txt


In the sounds subdirectory, there should be a file called materials.txt. This file assigns material sounds to textures to add a bit of realism. Whenever you hit crates in Half-Life, does it sound like wood? Of course it does. If there wasn't a materials.txt, then crates would sound like concrete when you struck them, and dirt would sound like concrete when walking on it as well.

The format for each line is like this:

<Type> <Texture Name>

The type can be "D" for dirt, "G" for grates, "M" for metal, "P" for electronics, "S" for liquids, "T" for tile,"V" for vents, "W" for wood, and "Y" for glass. To acheive the concrete sound, heh, don't list that texture here. Also, only the first 12 letters of texture names are recognized, and a maximum of 512 textures can be listed in the materials.txt.


Colors.lst and Strings.lst


This file contains a list of all the text colors and background colors used in the Half-Life launcher shell. It can be found in the gfx subdirectory and inside the shell folder. Here is a list of the colors found inside the file:

 CODE  
// The last three numbers on each entry are
// the amounts of Red, Green, and Blue respectively
// You should have an idea of RGB colors by now.
//
HELP_COLOR  255 255 255 //Button description text color
PROMPT_BG_COLOR 56 56 56  //Prompt dialogue background color - leave alone!
PROMPT_TEXT_COLOR   255 100 0   //Prompt dialogue text color
PROMPT_TITLE_COLOR  255 100 0   //Prompt dialogue title color
INPUT_TEXT_COLOR    255 100 0   //Text box text color
INPUT_BG_COLOR  0 0 0  //Text box background color
REFRESH_TITLE_COLOR  255 100 0  //Refresh dialogue title color
REFRESH_TEXT_COLOR  255 100 0   //Refresh dialogue text color
REFRESH_BG_COLOR    56 56 56  //Refresh dialogue background color - leave alone!


It is best to leave the dialogue box background colors at the default, because unless you plan to write code for changing all of it, you'll get these ugly colored boxes around your dialogue box text.
Did you know you can change any string in the Half-Life launcher shell? Well the strings.lst can help you do that. In this file, each line starts with the number of a defined string inside Half-Life. You can replace those strings by adding them to your mod's strings.lst. After that number should be the text (enclosed in quotation marks) that you want to replace the original text with.
Below is my complete list of all the string numbers. You'll have to figure out what the constants stand for though (they're not very hard); there are just too many to write descriptions for.

You can download my strings.lst here. It should list every string in the game, and there is even info on how to use it inside.


Pak0.pak


Haven't you wondered what this huge file is, yet? It's merely a storage file that contains all the graphics, models, sounds, and maps used in Half-Life. Inside the pak0.pak, are subdirectories identical to the ones I listed at the beginning of this guide. Each file in the pak0.pak is in its specific subdirectory. The trick of things is, that you can make your own pak0.pak and place your mod's files in it. This makes organization and updates much simpler.

Let's say if you had a model with the same name as one in the Half-Life's .pak, and put this model in your mods pak0.pak, then Half-Life would use your model instead of its own.
Now, if you were to also add another model (same name of course), and placed it in your mod's model directory, then you could override both models. This makes updates easy as you don't have to supply a new pak0.pak for each update.

Okay, but now how you go about making your own .pak file?
There is a nifty little program called Wally.
It lets you edit/create .pak files, texture .wads, and a wide assortment of image types.


In closing...


Finally I can say I have left my mark on Wavelength. Hope someone finds this useful... and if anyone sees anything wrong with anything in this guide, please say something to save me the embarassment. Everyone makes mistakes, and I'm kinda prone to making them :]

This guide is provided "as is" with no warrenty, and is correct to the best of my knowledge. If it screws your computer up then neither myself, nor TheWavelength.net is responsible for it. (Just some legal stuff)
Questions? Comments? Email me: earthquake@realsimpsons.com

Peaches,

-EarthQuake
(May 17, 2003)

Rate This Article
This article is currently rated: 4.8 out of 5.0 (6 Votes)

You have to register to rate this article.
User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
 
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (17 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!