Difference between revisions of "Making Your Portal Mod"
(I don't see the point in a "command prompt" repeating things that have already been said in plain English, especially since it's not even a real language, just some pseudocode.) |
|||
Line 1: | Line 1: | ||
+ | {{update}} | ||
This article will discuss how to create a Portal content mod, from scratch. Part | This article will discuss how to create a Portal content mod, from scratch. Part | ||
of the reason for creating the mod from scratch is that Valve does not provide a | of the reason for creating the mod from scratch is that Valve does not provide a |
Revision as of 03:42, 24 September 2013
This article needs to be updated to include current information regarding the subject. |
This article will discuss how to create a Portal content mod, from scratch. Part of the reason for creating the mod from scratch is that Valve does not provide a specific SDK or mod template for Portal. Another reason is that creating the mod from scratch is not difficult and is of general interest to Source SDK developers that would like to learn more about how everything works. So, let's get started.

client.dll
and server.dll
files is not provided by Valve. However, a modder can still modify anything that isn't built directly into the game, which includes scenes, scripts, sounds, textures, and models, to name a few.
Contents
Prerequisites
To follow along with this article, you will need a copy of Portal and the Source SDK, installed on Steam.
Creating the Mod
Creating the mod consists of creating a game folder and filling it with
configuration files and mod-related content. Let's assume we are creating a mod
named "My Portal Mod", and that [Steam Root]
is Steam's
installed path on your machine. (e.g. C:\Program Files (x86)\Steam
)
Create the Game Folder
Navigate to your SourceMods
directory and create a folder named
"MyPortalMod".
In this new directory, create a file called GameInfo.txt
.
Edit the contents of GameInfo.txt
so that they look similar to the
following snippet. For details about the structure of this file, see
Gameinfo.txt.
"GameInfo"
{
game "My Portal Mod"
title "My Portal Mod"
type singleplayer_only
icon "myportalmod" // Assumes myportalmod.tga is in the same directory as GameInfo.txt
nodifficulty 1
hasportals 1
FileSystem
{
SteamAppId 400
ToolsAppId 211
SearchPaths
{
Game |gameinfo_path|.
Game portal
Game hl2
}
}
}
Restarting Steam at this point will create an entry in the game Library for the
mod. Deleting the game folder we created or removing the
GameInfo.txt
file will remove the entry.
Configure the Mod
Initial Setup
Let's add some standard folders to the game directory that will hold our mod's configuration files and content. Add the following folders to your game directory:
cfg
resource
maps
.
While we're at it, let's add the following optional folders, for custom content like models and sounds:
materials
models
scenes
scripts
sound
Create a Map List
In your game directory, create a file called maplist.txt
. In it, we
will list all of the mod's map names (excluding the .bsp
extension). This file allows the game to pre-cache the first .125 milliseconds
of sound for a map, which is enough time to load the remainder. [confirm]
The following is a sample maplist.txt
for a mod with two maps,
named myportalmod_map_00.bsp
and
myportalmod_map_01.bsp
.
myportalmod_map_00
myportalmod_map_01
Create Chapter Configuration Files
Change to your mod's cfg
directory. Create configuration files for
each chapter of your mod, starting with chapter1.cfg
and continuing
on to chapter2.cfg
, etc.
In these files, you will issue whatever commands you want to be executed by the
developer console when the chapter is first loaded. Typically, a command to load
the chapter's corresponding map is used.
The following is a chapter1.cfg
example:
map myportalmod_map_00
Create a Localization File
Create a localization file, called MyPortalMod_english.txt
, in your
game directory's resource
folder.
Modify the contents of MyPortalMod_english.txt
so that it is
similar to the following:
"lang"
{
"Language" "english"
"Tokens"
{
"MyPortalMod_chapter1" "The First Chapter"
"MyPortalMod_chapter2" "The Second Chapter"
}
}
In this case, MyPortalMod
is used because it is the name of the
mod's game directory. "The First Chapter" is an english title for the mod's
first chapter. Add any additional chapters for your mod by following the
pattern in "Tokens".


Save As...
, this is equivalent to choosing unicode
for the Encoding
option at the bottom of the dialog.Setting Up Hammer


Launch the 'Source SDK' from your Steam Library 'Tools' section. Make sure that
the 'Engine Version' pull-down has "Source Engine 2009" selected. Select 'Edit
Game Configurations'. From the pop-up menu, select 'Add'. A second pop-up will
appear, asking for a name and a directory. Enter the name that you want your
mod to be listed as (with respect to the 'Source SDK' tool) and enter the path to
your game directory ([Steam Root]\steamapps\SourceMods\MyPortalMod
).
Then select 'OK' for the second and first pop-ups. Assume we named our game
configuration "My Portal Mod".
Restart the 'Source SDK' tool. Set 'Engine Version' and 'Current Game' to
'Source Engine 2009' and 'My Portal Mod', respectively. Now, select 'Hammer
Editor'. In the editor, select Tools > Options
. A 'Configure
Hammer' pop-up should appear. Select the 'Game Configurations' tab and then hit
the 'Add' button for 'Game Data Files'. Select the file portal.fgd
and accept the changes. These configurations will be saved and restored the next
time you open Hammer from the 'Source SDK' tool with your mod name selected.
See Also