Create a Content-Only Mod

From Valve Developer Community
Jump to navigation Jump to search
Icon-under construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.

This tutorial will explain how to create a simple, content-only Source mod. This means your mod can have custom maps, textures, models, and sounds, but you cannot change the source code. This method is acceptable for simple campaigns and mappacks that do not significantly change how the underlying game works.


If you want to make a mod that does change the source code, see Setting up Source SDK Base 2013 Singleplayer or Setting up Source SDK Base 2013 Multiplayer.

Note.pngNote: It is not possible to add new weapons (although you can reskin existing ones).

Basic Setup

Create the mod folder

  1. Create a folder under c:/program files (x86)/steam/steamapps/sourcemods/ (A mod can actually reside anywhere, but placing it here allows Steam to detect and launch it.)
  2. Inside the folder, create a file named gameinfo.txt.
  3. Copy and paste the following into gameinfo.txt:
"GameInfo" { game "My Mod" // Name as it appears on Steam (and in the titlebar) title "My Mod" // Name as it appears on the main menu type singleplayer_only FileSystem { SteamAppId 420 // Indicates to Steam which game this is a mod for SearchPaths { // User customizations game+mod ep2/custom/* game+mod episodic/custom/* game+mod hl2/custom/* // Mod files mod+mod_write+default_write_path |gameinfo_path|. // Half life 2 and Episodic VPKs. game_lv hl2/hl2_lv.vpk game+mod ep2/ep2_sound_vo_english.vpk game+mod ep2/ep2_pak.vpk game |all_source_engine_paths|episodic/ep1_sound_vo_english.vpk game |all_source_engine_paths|episodic/ep1_pak.vpk game |all_source_engine_paths|hl2/hl2_sound_vo_english.vpk game |all_source_engine_paths|hl2/hl2_pak.vpk game |all_source_engine_paths|hl2/hl2_textures.vpk game |all_source_engine_paths|hl2/hl2_sound_misc.vpk game |all_source_engine_paths|hl2/hl2_misc.vpk platform |all_source_engine_paths|platform/platform_misc.vpk // Add the HL2 directory as a game search path. This is also where where writes // to the "game" path go. game+game_write ep2 // Where the game's binaries are (client.dll and server.dll) gamebin episodic/bin // Last, mount in shared HL2 loose files game |all_source_engine_paths|episodic game |all_source_engine_paths|hl2 platform |all_source_engine_paths|platform } } }

This will name the mod "My Mod", and it will load in assets from episode 2.

  • game at the very top is the name of your mod as it will appear on steam.
  • title is the name that will appear on the main menu.
  • The SearchPaths section describes the order in which the engine will look for assets. In this case, it will look in the custom folder first, then the mod folder, and then HL2 and Episode 2 as a fallback.
Tip.pngTip:See Gameinfo.txt for more information.

Launching the Mod

  1. Restart steam (close it completely by going to the top left 'Steam' button then clicking exit, then reopen steam). Your mod should appear inside your library.
  2. Launch your mod. You should get something like this:
Image of an episode 2 mod main menu, with a corrupt title font.
The title text is rendered using a specialised font with some characters missing.

Don't worry about the broken title font. We will fix it later.


Setting Up Hammer for your Mod

Video tutorial: How to Set Up Hammer for your Source Engine Mod

  1. Locate hammer.exe for the game the mod is based on. In our case, HL2 Hammer is located in C:\Program Files (x86)\Steam\steamapps\common\Half-Life 2\bin.
  2. Run hammer at least once and then close it. This will create a file in the bin folder called GameConfig.txt.
  3. Open GameConfig.txt, copy the definition for "Half-Life 2: Episode Two" and paste it above what you just copied.
  4. Change the name (inside the double-quotes), to the name of your mod.
  5. Change GameDir to be the path to your mod folder (the one with gameinfo.txt inside).
  6. Change MapDir to be where you want to store your VMF files.
  7. Change BSPDir to be the maps folder inside your mod directory. This is where compiled BSPs will go.
    Warning.pngWarning:Make sure you create a folder called maps inside your mod folder. Otherwise, your maps will not compile!
  8. Save the file and exit.
  9. Open Hammer and select the config you created.

Further reading: Your First Map.

Fixing the Title

[Todo]


Where next?

Tip.pngTip:Feel free to copy over .res, .txt, and .cfg files from the base game as you need. The engine will always override base game assets with your mod's assets, if they exist. If this is not happening, the file is in the wrong location, or your SearchPaths are misconfigured.