Gameinfo.txt: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(otherlang2; first half reformatted)
(finished rewrite - added AdditionalContentId details)
Line 23: Line 23:
: These are the strings displayed in the main menu of your mod. They might be different from the strings displayed in Steam and on the desktop if you are using a fancy font.
: These are the strings displayed in the main menu of your mod. They might be different from the strings displayed in Steam and on the desktop if you are using a fancy font.
: <code>title2</code> (and 3, 4, etc.) are to enable you to apply different styles to different parts of your title. {{note|It's likely your title won't display right until you edit ClientTitleFont in <code>resource/clientscheme.res</code> to change its font. [[Half-Life 2]] uses a specially-made font ("HalfLife2") that only has a specific set of characters; it won't display most text properly.}}
: <code>title2</code> (and 3, 4, etc.) are to enable you to apply different styles to different parts of your title. {{note|It's likely your title won't display right until you edit ClientTitleFont in <code>resource/clientscheme.res</code> to change its font. [[Half-Life 2]] uses a specially-made font ("HalfLife2") that only has a specific set of characters; it won't display most text properly.}}
; <code>gamelogo <[[boolean]]></code>
; {{EP2 add|<<code>gamelogo <[[boolean]]></code>}}
: Rather than displaying the <code>title</code>/<code>title2</code> text, display the content in <code>resource/GameLogo.res</code>. This was used for all three of the games in the [[Orange Box]].
: Rather than displaying the <code>title</code>/<code>title2</code> text, display the content in <code>resource/GameLogo.res</code>. This was used for all three of the games in the [[Orange Box]].


Line 32: Line 32:
; <code>nodifficulty <boolean></code>
; <code>nodifficulty <boolean></code>
: Hides the difficulty tab
: Hides the difficulty tab
; <code>hasportals <boolean></code>
; {{EP2 add|<<code>hasportals <boolean></code>}}
: Shows the Portal options tab
: Shows the Portal options tab
; <code>nocrosshair <boolean></code>
; <code>nocrosshair <boolean></code>
Line 41: Line 41:
: Hides toggle checkbox for <code>cl_himodels</code>. Only displayed properly if <code>cl_himodels</code> exists in the first place!
: Hides toggle checkbox for <code>cl_himodels</code>. Only displayed properly if <code>cl_himodels</code> exists in the first place!


=== Steam Games list ===
=== Steam games list ===


; <code>developer <[[string]]></code>
; <code>developer <[[string]]></code>
Line 57: Line 57:
: Maps in the subkey do not appear in the "create server" dialogue (but can still be loaded from the console).
: Maps in the subkey do not appear in the "create server" dialogue (but can still be loaded from the console).
: Syntax is <code>mapname 1</code>, with one entry per line. Don't include <code>.bsp</code>. Remember to open and close the subkey with { and }.
: Syntax is <code>mapname 1</code>, with one entry per line. Don't include <code>.bsp</code>. Remember to open and close the subkey with { and }.
; <code>nodegraph <[[boolean]]></code>
; {{EP2 add|<<code>nodegraph <[[boolean]]></code>}}
: Prevents the engine from creating [[nodegraph]]s for NPCs.
: Prevents the engine from creating [[nodegraph]]s for NPCs.


== Mounted content and required games ==
== Mounted content and required games ==


== SteamAppId ==
There are two stages to getting at a game's content:
The main relevant thing in the <code>GameInfo.txt</code> file is the <code>SteamAppId</code> variable. If you look inside GameInfo.txt, you'll see a section that looks something like this:


SteamAppId 215 //This will mount all the GCFs we need (240=CS:S, 220=HL2).
# Mount its AppID
# Mount its folder as a searchpath


The <code>SteamAppId</code> value specifies which game content (i.e. [[GCF]] files) is accessible to the game.
This all happens within the <code>filesystem</code> key.


{{note|All mods should use the mod-dedicated <code>215</code> AppId unless there is a specific need for another, such as 218 to load the Orange Box Source Engine.}}
{{warning|Your mod will not be protected by [[VAC]] if it is based on a single-player game.}}
{{warning|Be careful when choosing which games on which to base your mod. '''You will not be able to rely on unshared content from other games.'''}}
{{warning|'''To VAC-protect your multiplayer mod, be sure to base it on a multiplayer game'''. [[HL2DM]] is usually a good choice.}}


The <code>SteamAppId</code> values for the core Source games can be found at [[Steam Application IDs]]. Shared GCFs will have 'shared' in their filename and can always be accessed; everything else is private to the game in question.
; <code>SteamAppID <[[int]]></code>
 
: The [[Steam Application IDs|appid]] of the game the mod is to be based on. The mod will have access to all of its content, and not be playable unless it is installed.
== FileSystem ==
: For most mods this will be either 215 (Ep1) or 218 (OB), both of which point to different versions of [[Source SDK Base]].
This section describes various components of FileSystem in detail
; {{EP2 add|<code>AdditionalContentId <int></code>}}
 
: Another game that the mod both has access to and depends on. Any number of <code>AdditionalContentId</code>s can be specified. {{note|The engine understands this command, but the SDK tools unfortunately do not! The best solution, currently, is to copy the content of the game to a location on your hard drive and add an absolute <code>SearchPath</code> to it (see below). Remember to delete the SearchPath before you release.}}
=== ToolsAppId ===
; <code>ToolsAppId <int></code>
All <code>GameInfo.txt</code> files should contain a line like this:
: This is the appid of the SDK currently in use. Currently, the only valid value is 211 (i.e. the Source SDK).
 
ToolsAppId 211 //Tools will load this (ie: source SDK caches) to get
//things like materials\debug, materials\editor, etc.
 
This is a special case that tools use so they can load special content that is used by the tools, but is not used by the games.


=== SearchPaths ===
=== SearchPaths ===
The <code>SearchPaths</code> section of the <code>GameInfo.txt</code> file describes where the content is to be found, either on your hard drive or inside Steam cache files. To understand this part, we must take a detour into how programmers using the Source engine access the game's files. All files that a programmer accesses in code must exist under a <i>path ID</i>. A path ID describes one or more locations on your hard drive or inside virtual Steam file systems.
As an example, most of your game's resources like scripts, sounds, model files, and materials are accessed under the <code>"Game"</code> path ID. A programmer might say, "open a file called <code>scripts\weapon_m4a1.txt</code> inside the <code>'Game'</code> path ID". If you were running a mod in <code>C:\MyMod\Blasters</code>, and you used <code>SteamAppId 240</code> which would load in the Counter-Strike: Source content, then it would look for the file in these locations:
* <code>C:\MyMod\Blasters\scripts\weapon_m4a1.txt</code>
* <code><Steam install directory>\Steam\SteamApps\username\Counter-Strike Source\cstrike\scripts\weapon_m4a1.txt</code>
* <code><inside the virtual Steam file system>\cstrike\scripts\weapon_m4a1.txt</code>
Using path IDs to describe where the files are saves the programmer and artist from having to worry about all these different directories. They can use names relative to the game directory (like <code>scripts\weapon_m4a1.txt</code> or <code>materials\brick\brickwall001a.vmt</code>) and the engine and tools will find the full path to the file wherever it exists, as long as <code>GameInfo.txt</code> describes what the <code>"Game"</code> path ID means.
Inside the <code>GameInfo.txt</code> file, there is a section called <code>"SearchPaths"</code>, which describes the path IDs. Most mods will never need to modify the way these are setup from the way they are created when you run '''Create a Mod''' from the SDK launcher.
The first part of each line is the name of the path ID, and the second part is where to look for files when this path ID is used. A simple example, which is illustrative, but you would never use (because it uses absolute paths including drive letters, which you can never assume exist on a user's machine) is this:
SearchPaths
{
TestPathID C:\TestMod1
TestPathID C:\TestMod2
TestPathID C:\TestMod3
}
If a programmer were to write code that asked for scripts\weapon_m4a1.txt and specify "TestPathID" as the path ID in code, then the engine would look for the file in these locations:
* <code>C:\TestMod1\scripts\weapon_m4a1.txt</code>
* <code>C:\TestMod2\scripts\weapon_m4a1.txt</code>
* <code>C:\TestMod3\scripts\weapon_m4a1.txt</code>
Since the Source games access most of their content in the <code>"Game"</code> path ID, they do some things for you automatically if you have a path ID called <code>"Game"</code>. For each entry with a path ID of <code>"Game"</code>:


# It adds a <code>"GameBin"</code> path ID, in <code><dir>\bin</code>
<code>SearchPaths</code> is a further subkey group within <code>FileSystem</code>. It contains a list of folders that the engine will search for content in, with the pattern <code>Game <path></code>.
# It adds another <code>"Game"</code> path in front of it with <code>_<language></code> at the end. For example: <code>c:\hl2\cstrike</code> would get a <code>c:\hl2\cstrike_french</code> path added to it if you were running on a French-localized machine.


For the first <code>"Game"</code> search path:
The engine starts its search in the first path, and stops as soon as it finds the file it's looking for. This means that the order in which you provide search paths is important: files in one search path override those in paths below it.


# It adds a search path called <code>"MOD"</code> under the same folder.
A path is normally relative to <code>SteamAppID</code>'s root directory (i.e. where hl2.exe is located) or absolute (e.g. <code>C:\SomeFolder\</code>). There are two "magic words" you can use to overcome this:
# It adds a search path called <code>"DEFAULT_WRITE_PATH"</code>.


The default <code>SearchPaths</code> that would be used in most mods are like this:
# '''<code>|all_source_engine_paths|</code>''' (points to the folders of both the <code>SteamAppID</code> and any <code>AdditionalContentId</code>s you have used)
# '''<code>|gameinfo_path|</code>''' (points to the folder containing your mod's gameinfo.txt)


SearchPaths
Finally, Source automatically creates localised search paths from each path you provide. For example, passing <code>hl2</code> means that <code>hl2_french</code> is added too (if the player runs your mod in that language). {{todo|Does this also apply for the mod folder itself?}}
{
Game        |gameinfo_path|.
Game        hl2
}


Normally, a path specifier (the part on the right side) is relative to the base directory --The directory where <code>hl2.exe</code> is found. If <code>|gameinfo_path|</code> precedes the path, then it is relative to the directory where <code>GameInfo.txt</code> file instead. For example, if the <code>GameInfo.txt</code> file were in <code>C:\MyMod\Blasters</code>, and it had a path like <code><i>|gameinfo_path|SomeTestDirectory</i></code>, then the path ID you were creating would refer to:
=== Example ===


<code>C:\MyMod\Blasters\SomeTestDirectory</code>
The following code would mount the content of both [[Episode Two]] and [[Portal]]:


For Counter-Strike: Source, the <code>GameInfo.txt</code> file has a <code>SearchPaths</code> section that looks like the one above. If your Counter-Strike directory was:
<source lang=ini>FileSystem
{
SteamAppId 420 // Ep2
ToolsAppId 211
AdditionalContentId 400 // Portal


<code>C:\Program Files\Valve\Steam\SteamApps\username\Counter-Strike Source</code>
SearchPaths
{
Game |gameinfo_path|. // Your mod folder should always come first
Game |all_source_engine_paths|ep2
Game |all_source_engine_paths|episodic // Ep2 also uses some Ep1 content
Game |all_source_engine_paths|portal
Game |all_source_engine_paths|hl2 // HL2 should always come last
}
}</source>


then it would be saying to look in these two directories:
Episode Two comes first and so has priority. This means that you won't be able to use portals, as the Ep2 game code will be loaded - but you ''could'' pitch [[GLaDOS]] against a pack of [[Hunter]]s!


* <code>C:\Program Files\Valve\Steam\SteamApps\username\Counter-Strike Source\cstrike</code>
If you did want to use Portal's game code, you would simply promote its search path above Ep2's.
because GameInfo.txt exists here.
* <code>C:\Program Files\Valve\Steam\SteamApps\username\Counter-Strike Source\hl2</code>
which only exists inside a virtual Steam file system.


[[category:Technical]]
[[category:Technical]]
[[Category:Modding]]
[[Category:Modding]]
[[Category:Source SDK FAQ]]
[[Category:Source SDK FAQ]]

Revision as of 15:12, 16 July 2009

Template:Otherlang2

For Half-Life 1 (i.e. GoldSrc), see liblist.gam.

GameInfo.txt describes your mod. It contains metadata like its name, a link to your website and a manual, and defines which games it needs to run. It is also the marker that Steam, Source and the SDK tools use to detect the location of your project.

The SDK launcher generates a gameinfo.txt when you run the Create a Mod Wizard. This will work fine for development, but before release you will want to edit it and add new data.

Note.pngNote:Boolean values are represented as integers.
Warning.pngWarning:If a value has any spaces or tabs in it, wrap it in "quote marks".

UI settings

Name

game <string>
The name of your mod. Displayed in Steam, on the Windows task bar, but not on the main menu (unless you don't define a title).
title <string>
title2 <string>
These are the strings displayed in the main menu of your mod. They might be different from the strings displayed in Steam and on the desktop if you are using a fancy font.
title2 (and 3, 4, etc.) are to enable you to apply different styles to different parts of your title.
Note.pngNote:It's likely your title won't display right until you edit ClientTitleFont in resource/clientscheme.res to change its font. Half-Life 2 uses a specially-made font ("HalfLife2") that only has a specific set of characters; it won't display most text properly.
Template:EP2 add
Rather than displaying the title/title2 text, display the content in resource/GameLogo.res. This was used for all three of the games in the Orange Box.

Options

type <singleplayer_only | multiplayer_only>
Affects which tabs appear in which order the Options panel. May also affect Steam's download speed. Omit if your mod has both SP and MP modes.
nodifficulty <boolean>
Hides the difficulty tab
Template:EP2 add
Shows the Portal options tab
nocrosshair <boolean>
Hides the multiplayer crosshair selection menu
nomodels <boolean>
Hides the multiplayer model selection menu
nohimodel <boolean>
Hides toggle checkbox for cl_himodels. Only displayed properly if cl_himodels exists in the first place!

Steam games list

developer <string>
Your team's name (or just yours!)
developer_url <string>
Your or the mod's website. Must start with http://.
manual <string>
URL to the mod's manual; can be local.
icon <string>
Local path, relative to gameinfo.txt, to an uncompressed 16x16 TGA that will appear as your mod's icon in Steam. Do not include the file extension. For transparency to work, the TGA must be saved in 32-bit mode with active alpha channel.

Miscellaneous

hidden_maps <subkey>
Maps in the subkey do not appear in the "create server" dialogue (but can still be loaded from the console).
Syntax is mapname 1, with one entry per line. Don't include .bsp. Remember to open and close the subkey with { and }.
Template:EP2 add
Prevents the engine from creating nodegraphs for NPCs.

Mounted content and required games

There are two stages to getting at a game's content:

  1. Mount its AppID
  2. Mount its folder as a searchpath

This all happens within the filesystem key.

Warning.pngWarning:Your mod will not be protected by VAC if it is based on a single-player game.
SteamAppID <int>
The appid of the game the mod is to be based on. The mod will have access to all of its content, and not be playable unless it is installed.
For most mods this will be either 215 (Ep1) or 218 (OB), both of which point to different versions of Source SDK Base.
Template:EP2 add
Another game that the mod both has access to and depends on. Any number of AdditionalContentIds can be specified.
Note.pngNote:The engine understands this command, but the SDK tools unfortunately do not! The best solution, currently, is to copy the content of the game to a location on your hard drive and add an absolute SearchPath to it (see below). Remember to delete the SearchPath before you release.
ToolsAppId <int>
This is the appid of the SDK currently in use. Currently, the only valid value is 211 (i.e. the Source SDK).

SearchPaths

SearchPaths is a further subkey group within FileSystem. It contains a list of folders that the engine will search for content in, with the pattern Game <path>.

The engine starts its search in the first path, and stops as soon as it finds the file it's looking for. This means that the order in which you provide search paths is important: files in one search path override those in paths below it.

A path is normally relative to SteamAppID's root directory (i.e. where hl2.exe is located) or absolute (e.g. C:\SomeFolder\). There are two "magic words" you can use to overcome this:

  1. |all_source_engine_paths| (points to the folders of both the SteamAppID and any AdditionalContentIds you have used)
  2. |gameinfo_path| (points to the folder containing your mod's gameinfo.txt)

Finally, Source automatically creates localised search paths from each path you provide. For example, passing hl2 means that hl2_french is added too (if the player runs your mod in that language).

Todo: Does this also apply for the mod folder itself?

Example

The following code would mount the content of both Episode Two and Portal:

FileSystem
{
	SteamAppId	420	// Ep2
	ToolsAppId	211
	AdditionalContentId	400	// Portal

	SearchPaths
	{
		Game	|gameinfo_path|.	// Your mod folder should always come first
		Game	|all_source_engine_paths|ep2
		Game	|all_source_engine_paths|episodic	// Ep2 also uses some Ep1 content
		Game	|all_source_engine_paths|portal
		Game	|all_source_engine_paths|hl2	// HL2 should always come last
	}
}

Episode Two comes first and so has priority. This means that you won't be able to use portals, as the Ep2 game code will be loaded - but you could pitch GLaDOS against a pack of Hunters!

If you did want to use Portal's game code, you would simply promote its search path above Ep2's.