Making Your Portal Mod: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
{{warning|This tutorial contains inaccuracies and needs to be fixed!}}
{{warning|This tutorial contains inaccuracies and needs to be fixed!}}


== Notice ==
== Not an executable mod ==
 
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.
This article explains how to make a "content-mod" for Portal. You will NOT be able to edit any code or add any new weapons, features, etc, to Portal. You can add maps, models, materials, etc.


== Getting started ==
== Getting started ==
First, to start, get [[GCFScape]].
You do NOT need any tools to do this (apart from Windows, Steam and a copy of Portal on Steam).
Download [http://nemesis.thewavelength.net/index.php?p=26 here]


== Creating Necessary Folders ==
== 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.
In a Windows Explorer window, navigate to your Steam directory. Then go to the folders: SteamApps, sourcemods.
'''
Inside sourcemods, create a folder. For this tutorial I will use "MyPortalMod". You can use anything -- it does not affect the mod's actual name.
Inside your new mod folder, create the following folders named:
Make the following folders:
 
'''Required folders:'''


     * cfg
     * cfg
     * resource
     * resource
     * maps
     * maps
    * materials -- Optional
    * models -- Optional
    * sound -- Optional (not SOUNDS, just sound)
    * scripts -- Optional
    * scenes -- Optional


'''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 [http://www.flos-freeware.ch/notepad2.html Notepad2].


In your main mod folder, open GameInfo.txt. it will look like this:
== Create files ==
 
Create and open a file called GameInfo.txt.
<pre>"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
      }
  }
}</pre>
 
 
you can replace that file with the following, but you should be sure you have at least some understanding of what these changes mean.


Copy and paste this into the file and then we'll go through what it means.
<pre>"GameInfo"
<pre>"GameInfo"
{
{
Line 112: Line 51:
}</pre>
}</pre>


'''
game "MyPortalMod" Tells Steam that the name of this game is MyPortalMod. This will appear in the Steam menu.
These lines:'''
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. Not sure of the point of this.
game       "MyPortalMod"
"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.
title      "MyPortalMod"
nodifficulty 1 Tells Source not to show difficulty settings.
Tell Steam and the Source engine what the name of this mod is.
hasportals 1 Tells Portal's Source that this game includes portals. Not sure of the point of this.
'''
The rest is telling Steam to load Portal's Source engine and models.
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:
 
<pre>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</pre>
 
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.<br>
Use [http://www.flos-freeware.ch/notepad2.html Notepad2] or another Unicode-savvy editor to edit or convert these files.'''}}
 
Find the following lines:
<pre>"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"</pre>
 
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:
Now, create a file called maplist.txt. In this, put all of your mod's map names without the ".bsp" extenstion.
Not sure of the point of this. Maybe to make chapters work.


"MyPortalMod_Chapter2_Title" "your second chapter name"
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.


and so on for chapter 3, 4...
Now, create a file called MyPortalMod_english.txt with the name of your mod's folder replacing MyPortalMod.
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.
Save the file AS UNICODE. IT HAS TO BE UNICODE.


== Setting up Source SDK to work with your mod ==
== Setting up Source SDK to work with your mod ==
To set up the SDK to work with your mod, navigate to
Go into Source SDK. Select Edit Game Configurations.
 
<pre>Steam\SteamApps\<username>\sourcesdk\bin\orangebox\bin</pre>
 
and open up the text file '''GameConfig'''
 
Find where it says:
 
<pre> "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\portal.fgd"
}
}
</pre>
 
 
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:
 
<pre>"MapDir"      "c:\program files\steam\steamapps\<username>\sourcesdk_content\portal\mapsrc"
"BSPDir"      "c:\program files\steam\steamapps\SourceMods\'''your mod name'''\maps"</pre>
 
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!
 
== Setting up the Hammer Editor ==
== Setting up the Hammer Editor ==
To set up your Hammer Editor klick '''Tools''' and then '''Options'''.
To set up your Hammer Editor klick '''Tools''' and then '''Options'''.

Revision as of 02:25, 15 December 2011

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.
Warning.pngWarning:This tutorial contains inaccuracies and needs to be fixed!

Not an executable mod

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.

Getting started

You do NOT need any tools to do this (apart from Windows, Steam and a copy of Portal on Steam).

Creating Necessary Folders

In a Windows Explorer window, navigate to your Steam directory. Then go to the folders: SteamApps, sourcemods. Inside sourcemods, create a folder. For this tutorial I will use "MyPortalMod". You can use anything -- it does not affect the mod's actual name. Make the following folders:

   * cfg
   * resource
   * maps
   * materials -- Optional
   * models -- Optional
   * sound -- Optional (not SOUNDS, just sound)
   * scripts -- Optional
   * scenes -- Optional


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. Not sure of the point of this. "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. Not sure of the point of this. 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. Not sure of the point of this. Maybe to make chapters work.

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, create a file called MyPortalMod_english.txt with the name of your mod's folder replacing MyPortalMod. 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. Save the file AS UNICODE. IT HAS TO BE UNICODE.

Setting up Source SDK to work with your mod

Go into Source SDK. Select Edit Game Configurations.

Setting up the Hammer Editor

To set up your Hammer Editor klick Tools and then Options. Under Game Data Files klick add and navigate to steam/steamapps/UserName/sourcesdk/bin/orangebox/bin/ and add portal.fgd.Now klick OK and you can use things like the Portal-Gun in your maps.

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