Difference between revisions of "Making Your Portal Mod"

From Valve Developer Community
Jump to: navigation, search
(Corrected errors and added links to Notepad2 text editor)
m (Added 'See also')
Line 249: Line 249:
 
So head over here: http://developer.valvesoftware.com/wiki/Category:Modding
 
So head over here: http://developer.valvesoftware.com/wiki/Category:Modding
 
To learn more on modding if needed.
 
To learn more on modding if needed.
 +
 +
==See Also==
 +
 +
* [[Portal mod template]]

Revision as of 15:04, 6 July 2008

Getting started

First, to start, get GCFScape. Download here

Creating Necessary Folders

In windows, navigate to Steam\SteamApps\Sourcemods\ and create a folder for your mod. for this tutorial i'm going to use the name "MyPortalMod", but you will of course call it whatever you want. Note, this name isn't the name of the mod that appears in the Steam games list, this is just the mods directory folder name. Inside your new mod folder, create the following folders named:

Required folders:

   * cfg
   * resource
   * maps

optional folders

   * materials -- This is if you want to add custom materials to your mod
   * models -- This is if you want to add custom models to your mod
   * sounds -- This is if you want to add custom sounds to your mod
   * scripts -- This is if you want to add custom scripts to your mod (also required for custom scenes)
   * scenes -- This is if you want to add custom scenes to your mod (if so, you will need the scripts folder)

Extract Necessary Files

Navigate to Steam\SteamApps\ and open portal content.gcf with GCFScape. in GCFScape, expand the "portal" folder. now we need to extract some files. The easy way to do this is to drag and drop, so navigate back to Steam\SteamApps\SourceMods\MyPortalMod.

From the portal content.gcf folder:

Extract "GameInfo.txt" and "maplist.txt" into your mod folder.

While still in the portal content.gcf go into the "cfg" folder and extract chapter1.cfg into your mods cfg folder.

While still in the portal content.gcf go into the resource folder and extract portal_english.txt into your mods resource folder. you can close GCFScape now.

Edit files

Note: some of these files are in formats that windows doesn't recognize at first, but all of them can be safely opened and edited with Notepad2.

In your main mod folder, open GameInfo.txt. it will look like this:

"GameInfo"
{
   game      "Portal"
   title       "Portal"
   type      singleplayer_only
   nodifficulty   1
   hasportals   1
   FileSystem
   {
      SteamAppId            400      // This will mount all the GCFs we need (240=CS:S, 220=HL2).
      ToolsAppId            211      // Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
      
      //
      // The code that loads this file automatically does a few things here:
      //
      // 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
      // 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
      //    For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
      // 3. For the first "Game" search path, it adds a search path called "MOD".
      // 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
      //

      //
      // Search paths are relative to the base directory, which is where hl2.exe is found.
      //
      // |gameinfo_path| points at the directory where gameinfo.txt is.
      // We always want to mount that directory relative to gameinfo.txt, so
      // people can mount stuff in c:\mymod, and the main game resources are in
      // someplace like c:\program files\valve\steam\steamapps\half-life 2.
      //
      SearchPaths
      {
         Game            |gameinfo_path|.
         Game            portal
         Game            hl2
      }
   }
}


you can replace that file with the following, but you should be sure you have at least some understanding of what these changes mean.

"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
      }
   }
}

These lines:

game "MyPortalMod" title "MyPortalMod" Tell Steam and the Source engine what the name of this mod is. This line: type singleplayer_only should be self explanatory. It defines what type of game this is. Since portal is single player at least for the moment, we will leave this alone. This line: "icon" "icon" Tells steam where the icon for this mod is located. we don't have an icon yet, but if you made one, it must be a uncompressed TGA format 16x16 image, and must be called icon and it must be placed in your mods main directory, then steam would know where to look for it. sometimes this can be a little bit troublesome, as sometimes steam needs to be restarted several times before it notices that the icon is present.

Everything after those lines i left the same except i deleted all of the comments. (comments are ignored by steam anyway).

Next, in the mods main folder, open the file maplist.txt it will look like this:

background1
background2
testchmb_a_00
testchmb_a_01
testchmb_a_02
testchmb_a_03
testchmb_a_04
testchmb_a_05
testchmb_a_06
testchmb_a_07
testchmb_a_08
testchmb_a_09
testchmb_a_10
testchmb_a_11
testchmb_a_13
testchmb_a_14
testchmb_a_15
escape_00
escape_01
escape_02
testchmb_a_08_advanced
testchmb_a_09_advanced
testchmb_a_10_advanced
testchmb_a_11_advanced
testchmb_a_13_advanced
testchmb_a_14_advanced

delete all of that and replace it with the names of your maps. keep them in order, and remember that you don't need the ".bsp" file name extension on the end of the names in this list.

-now go into your cfg folder and open chapter1.cfg it will only have one line: map testchmb_a_00

replace that with: map <yourfirstmapname>

<yourfirstmapname> should be the name of your first map, without the .bsp extension (just like it is in maplist.txt). this is your config file for chapter 1. Every time you want to add a new chapter, make a new config file and place the name of the first map of that chapter after the map text.

Now go into your mods resource folder, and change the name of portal_english.txt to <MyPortalMod>_english.txt. Then open it in Notepad2. You can remove any unnecessary lines without any problems - these are present in the unmodified game and will be referred to if they are missing in your version of <MyPortalMod>_english.txt

Warning: Source-based games use Unicode for the localization file (<game_or_mod_title>_english.txt, <game_or_mod_title>_german.txt, et cetera). Some text editors may save the file as ASCII-encoded.
Use Notepad2 or another Unicode-savvy editor to edit or convert these files.

Find the following lines:

"Portal_Chapter1_Title" "Testchamber 00"
"Portal_Chapter2_Title" "Testchamber 04"
"Portal_Chapter3_Title" "Testchamber 08"
"Portal_Chapter4_Title" "Testchamber 10"
"Portal_Chapter5_Title" "Testchamber 13"
"Portal_Chapter6_Title" "Testchamber 14"
"Portal_Chapter7_Title" "Testchamber 15"
"Portal_Chapter8_Title" "Testchamber 16"
"Portal_Chapter9_Title" "Testchamber 17"
"Portal_Chapter10_Title" "Testchamber 18"
"Portal_Chapter11_Title" "Testchamber 19"
"Portal_Chapter12_Title" "Testing Complete"

and replace them with:

"MyPortalMod_Chapter1_Title" "your chapter name"

Now, of course you should replace the part that says "MyPortalMod" with the name of your mod, and "your chapter name" with whatever you want the first chapter to be called. when you are ready to add a second chapter, add:

"MyPortalMod_Chapter2_Title" "your second chapter name"

and so on for chapter 3, 4...

Setting up Source SDK to work with your mod

To set up the SDK to work with your mod, navigate to

Steam\SteamApps\<username>\sourcesdk\bin\orangebox\bin

and open up the text file GameConfig

Find where it says:

		"Portal"
		{
			"GameDir"		"c:\program files\steam\steamapps\SourceMods\'''you mod name'''"
			"hammer"
			{
				"TextureFormat"		"5"
				"MapFormat"		"4"
				"DefaultTextureScale"		"0.250000"
				"DefaultLightmapScale"		"16"
				"DefaultSolidEntity"		"func_detail"
				"GameExeDir"		"c:\program files\steam\steamapps\'''your username'''\half-life 2"
				"MapDir"		"c:\program files\steam\steamapps\sourcesdk_content\Portal\mapsrc"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
				"GameExe"		"c:\program files\steam\steamapps\'''your username'''\half-life 2\hl2.exe"
				"BSP"		"c:\program files\steam\steamapps\'''your username'''\sourcesdk\bin\orangebox\bin\vbsp.exe"
				"Vis"		"c:\program files\steam\steamapps\'''your username'''\sourcesdk\bin\orangebox\bin\vvis.exe"
				"Light"		"c:\program files\steam\steamapps\'''your username'''\sourcesdk\bin\orangebox\bin\vrad.exe"
				"BSPDir"		"c:\program files\steam\steamapps\SourceMods\'''your mod name'''\maps"
				"GameData0"		"c:\program files\steam\steamapps\'''your username'''\sourcesdk\bin\orangebox\bin\halflife2.fgd"
			}
		}


Change the new your mod name to your mods folder name, not the name in the gameinfo.txt, i mean the mods folder name in sourcemods.

In the part:

"MapDir"      "c:\program files\steam\steamapps\<username>\sourcesdk_content\portal\mapsrc"
"BSPDir"      "c:\program files\steam\steamapps\SourceMods\'''your mod name'''\maps"

You may change these outputs to any desired location if you want, MapDir is where hammer saves your Portal mod maps VMF's. And BSPDir is where hammer places a compiled map's bsp for your mod.

Note: The parts that says c:\program files\steam\ may not be exactly the same, but it should say the path to your Steam directory. And the parts that say your username you must replace with your Steam username.

Mapping for your new mod

That should complete the setup of your mod. now you just need to add maps to play. start up the SDK, and change "engine version" to "The Orange Box". in the current game dropdown list, there should now be an option for "MyPortalMod" (or whaatever you named it). Now when you make maps in this configuration, it will save the BSP files to where you chose the BSPDir you should be good to go!

Topics not covered for this mod

    * Creating a background map for the menu
    * Creating a background image for the menu
    * Creating images for the chapter titles

I have not chose to explain how to do this, because the way you do this for Half-Life 2 is the same for Portal. And also anything else that you do for a Half-Life 2 mod, is all done in the same manner for Portal. So head over here: http://developer.valvesoftware.com/wiki/Category:Modding To learn more on modding if needed.

See Also