Making Your Portal Mod

From Valve Developer Community
Revision as of 22:18, 23 July 2012 by Anotheruser67 (talk | contribs) (A couple of the modifications were inaccurate, but not most of them, so I modified them rather than reverting.)
Jump to navigation Jump to search
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

Modding Portal isn't hard as it seems. In fact, it's only slightly more difficult than modding any other Source-based game released before Alien Swarm (such as Half-Life 2). However, you will need to use a completely different method to modding Half-Life 2, but it is in no way more difficult. You do not need any tools to do this (apart from Windows, Steam and a copy of Portal on Steam). Remember, you can't modify the executables, libraries, or anything like that. You CAN modify/create scenes, scripts, sounds, textures, models, or anything else that isn't completely built into the game.

Step 1 - Getting Started

In a Windows Explorer window, navigate to the "steamapps\sourcemods" subdirectory in the directory where Steam is installed. Inside, create a folder. For this tutorial I will use "MyPortalMod". You can use anything -- it does not affect the mod's actual name. Then, make the following folders:

  • cfg
  • resource
  • maps
  • materials -- Optional
  • models -- Optional
  • sound -- Optional
  • scripts -- Optional
  • scenes -- Optional

Step 2 - Create files

Create and open a file called GameInfo.txt.

Copy and paste this into the file and then we'll go through what it means.

"GameInfo"
{
   game      "MyPortalMod"
   title       "MyPortalMod"
   type      singleplayer_only
   "icon"      "icon"

   nodifficulty   1
   hasportals   1

   FileSystem
   {
      SteamAppId            400
      ToolsAppId            211      

      SearchPaths
      {
         Game            |gameinfo_path|.
         Game            portal
         Game            hl2
      }
   }
}
  • game "MyPortalMod" tells Steam that the name of this game is MyPortalMod. This will appear in the Steam menu.
  • title "MyPortalMod" tells Source that it should display the title MyPortalMod on the titlescreen.
  • type singleplayer_only tells Source that this is NOT a multiplayer game. This makes the "multiplayer" tab not appear in Options.
  • "icon" "icon" tells Steam to look for a file called icon.tga, which will be the game's icon. Note: The FIRST "icon" is telling Steam this is the icon line, the SECOND icon is telling it to look for a file called icon.tga.
  • nodifficulty 1 tells Source not to show difficulty settings.
  • hasportals 1 tells Portal's Source that this game includes portals. If on, the "Portals" tab will appear in options.

The rest is telling Steam to load Portal's Source engine and models.

Now, create a file called maplist.txt. In this, put all of your mod's map names without the ".bsp" extenstion. This allows the game to precache the first .125 milliseconds of sound in the map, which is enough time to load the rest.

Change to your cfg directory and make a file called chapter1.cfg. Add all the lines you want executed in the developer console when you load the first chapter of your mod to this file. Usually all you'd do is type in map and then the name of the first map of chapter 1 without the ".bsp" extenstion. If you want more chapters make chapter2.cfg, chapter3.cfg, and so on.

Now, switch to your resources folder and create a file called MyPortalMod_english.txt with the name of your mod's folder replacing MyPortalMod. Type in

"lang" 
{ 
"Language" "english" 
"Tokens" 
{

Then type in text like this: "MyPortalMod_chapter1" "First Chapter" MyPortalMod is the name of your mod's folder. First Chapter is the name of your first chapter. Add additional lines with chapter2, chapter3, etc. instead of chapter1 for additional chapters. At the end, put:

} 
}

Save the file AS UNICODE. IT HAS TO BE UNICODE.

Step 3 - Setting up Source SDK and Hammer to work with your mod

Go into Source SDK and select Edit Game Configurations > Add. Type in the name you want your mod to be listed as in the Source SDK in the Name box and the path to your mod folder in the Directory box.

In Hammer Editor select Tools > Options. Then make sure you are on the Game Configurations tab and choose Add. Double-click on portal.fgd and click Open.

See Also