credits.txt

From Valve Developer Community
Revision as of 01:06, 9 December 2025 by Luke18033 (talk | contribs) (Document credits.txt in much more detail)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


credits.txt is the configuration file that defines the text displayed by env_credits, env_portal_credits, env_outtro_stats (when using the RollCredits input), and env_introcredits. It is located in the scripts/ folder in most games, or the game directory root in the Left 4 Dead series.

The file is standard KeyValues, with the root key typically named the same as the file. Its sub-keys define various components of the credits:

  • CreditsParams configures various settings for the credits display
  • IntroCreditsNames lists the names displayed in the intro credits (not in Left 4 Dead seriesLeft 4 Dead seriesPortal 2Black Mesa)
  • IntroCredits lists the names displayed in the intro credits across multiple maps (only in Black Mesa)
  • OutroCreditsNames lists the names displayed in the outro credits
  • OutroSongLyrics lists the lines for the Portal musical credits (only in Portal seriesPortal series)
  • OutroAsciiArt defines the ASCII art images that appear throughout Portal's credits (only in Portal)

Credits parameters

The CreditsParams block contains various pre-defined settings for how the credits should be displayed. Most of these only apply to specific credits types. All of the given default values are as defined in code, and may differ from what is actually used in Valve's games.


color <color255> (not in Left 4 Dead seriesLeft 4 Dead seriesPortal 2)
Color used for intro credits and Portal credits. Defaults to fully transparent, so this must be set for these credits to appear.

Outro credits

scrolltime <float>
The total number of seconds it will take to scroll through the outro credits. The speed of the scrolling will automatically be timed to this, making it easy to add new credit lines without having to manually adjust anything. Defaults to 57 seconds.
In Half-Life 2's style of credits, the last line will remain in the center of the screen for 10 (Xbox 360 2) seconds after this point before fading out and firing OnCreditsDone. In Portal 2, sp_ending_callback.bik will begin playing 4 seconds after, regardless of if the song has finished.
Todo: l4d
separation <float>
Spacing between outro credit lines, in pixels. Negative numbers can be used to place them closer together (e.g. if the font height is taller than the visible characters). Defaults to 5.

Intro credits

(not in Left 4 Dead seriesLeft 4 Dead seriesPortal 2)

fadeintime <float>
The time it takes for each intro credit line to fade in. Defaults to 1 second.
fadeholdtime <float>
The time each intro credit line will stay visible before beginning to fade out. Defaults to 3 seconds.
fadeouttime <float>
The time it takes for each intro credit line to fade in. Defaults to 1 second.
nextfadetime <float>
When switching between groups of three intro credits, this is the amount of time that the new lines will start fading in before the old ones have fully faded out. Defaults to 2 seconds.
pausebetweenwaves <float>
After each group of three intro credits have faded in, this is the time to wait before fading them out to draw the next group. Defaults to 2 seconds.
logotime <float>
Extra time to wait after showing the first set of three intro credits (typically just the Valve logo) before showing the rest. Defaults to 2 seconds.
posx <float>
X position of the intro credits. Defaults to 2.
posy <float>
Y position of the intro credits. Defaults to 2.

(not in Left 4 Dead seriesLeft 4 Dead seriesPortal 2)

Note.pngNote:env_portal_credits has Episode One's logo text hardcoded in and does not support these. Use the original env_credits instead if you want to show a logo in a Portal mod.
logo <string>
Text to be displayed when ShowLogo is used. This uses ClientTitleFont (same as the title screen logo) in the HL2 Episodes and Portal, or WeaponIcons in HL2. Defaults to HALF-LIFE', which will be drawn as the HL2 logo with the aforementioned fonts.
logo2 <string>
Second line of the logo, as used in the episodes. Defaults to blank.

Portal credits

cursorblinktime <float>
Time between cursor blinks in the Portal terminal-style credits. Defaults to 0.3 seconds.
scrollcreditsstart <float>
Sets how long after starting the Portal song credits that the actual developer credits will begin being typed out. The duration specified by scrolltime will start after this and is not shortened. Defaults to 6 seconds.

(only in Portal):

songstarttime <float>
Sets how long after starting the Portal credits that music/portal_still_alive.mp3 will be played. Defaults to 6.85 seconds.
screenxoffset <integer>
Horizontal offset of the terminal screen in pixels. Defaults to 0.
screenyoffset <integer>
Vertical offset of the terminal screen in pixels. Defaults to 0.
screenwidthadjustment <integer>
Extra width added to the terminal screen. Negative values can be used to make it smaller. Defaults to 0.
screenheightadjustment <integer>
Extra height added to the terminal screen. Negative values can be used to make it smaller. Defaults to 0.
asciiartfont <string>
Sets the font used for the ASCII art. Defaults to Default.
aascreenxoffset <integer>
Horizontal offset of the ASCII art in pixels. Defaults to 0, which has the left edge of the ASCII art at the center of the screen.
aascreenyoffset <integer>
Vertical offset of the ASCII art in pixels. Defaults to 0, which has the top edge of the ASCII art at the center of the screen.
aaseparation <integer>
Spacing between ASCII art lines, in pixels. Negative numbers can be used to place them closer together (e.g. if the font height is taller than the visible characters). Defaults to 0.

(only in Portal 2):

color_lyrics <color255>
Color of the lyrics text. Defaults to fully transparent, so this must be set for lyrics to appear.
color_credits <color255>
Color of the credits text. Defaults to fully transparent, so this must be set for credits to appear.

Intro/outro credits names

The IntroCreditsNames and OutroCreditsNames blocks define the names displayed in the intro and outro credits respectively. Both have the same format. For intro credits in Black Mesa, see the section below.

Each keyvalue represents a single line in the credits. The key name is the text that you want to appear on that line, while the value is the name of the font to use from clientscheme.res. Usually the font CreditsText is used for intro credits and CreditsOutroText used for outro credits, but you can swap these out or use different fonts on different lines in order to create headers or icons.

The intro credits are shown in groups of three, so you should take this into account when writing intro credits. The first three lines (showing the Valve logo in HL2) will fade in and fade out all at once, then the second group will fade in all at once, then it will begin going through the rest of the groups with a top-to-bottom fade animation.

In Black Mesa, outro credits prefixed with a question mark (?) will be left aligned, and credits prefixed with a exclamation point (!) will be right aligned and drawn on the same line as the previous credit. This allows creating dual-column credits.

Icon-Bug.pngBug:As a result of caching internally used by the KeyValues system, credit lines with the same text will use the capitalization and font from the first instance instead of what's specified. Capitalization changes will also not take effect until the game is restarted if the credits have previously been viewed during the current session.  (tested in: Half-Life 2)
Icon-Bug.pngBug:When using env_portal_credits, having a closing square bracket (]) anywhere in a line will cause it and all preceding text to disappear, despite this otherwise having no effect on credits names.  (tested in: Portal)

Example

"IntroCreditsNames"
{
	"V"         "WeaponIcons" // Valve logo
	" "         "CreditsText" // padding out the rest of the group
	" "         "CreditsText"
	"Credit1"   "CreditsText" // first real credit
	"Credit2"   "CreditsText"
	"Credit3"   "CreditsText"
	"Credit4"   "CreditsText" // new group of three
	"Credit5"   "CreditsText"
	"Credit6"   "CreditsText"
}

"OutroCreditsNames"
{
	"HALF-LIFE'" "CreditsOutroLogos" // HL2 logo
	" "          "CreditsOutroText" // spacing is purely aesthetic, there is no grouping for outro credits
	"V"          "CreditsOutroValve" // Valve logo
	" "          "CreditsOutroText"
	"Credit1"    "CreditsOutroText" // first real credit
	"Credit2"    "CreditsOutroText"
	"Credit3"    "CreditsOutroText"
	"Credit4"    "CreditsOutroText"
	" "          "CreditsOutroText"
	"v"          "CreditsOutroText" // last line, lingers for a few seconds. Will appear the same as the above Valve logo due to KV caching
}

Intro credits (Black Mesa)

Due to the tram ride being split across multiple maps, Black Mesa uses a different system for intro credits. The IntroCredits block holds subkeys corresponding to each map. Each of these then holds a totaltime key that sets the total amount of time that these credits should appear over, and a credits key holding the actual list of credits to display. Each credit has the text to display as the key name, and the value is not used.

Example

"IntroCredits" //Into credits start here.
{
    "map1" //The first map there we want to have credits.
	{
		"totaltime"		"90" //Total time (in seconds) we want to roll credits.
		"credits"
		{
			  "#Map1MyText1"              "#BLANK" //The first is the text that will be displayed, the second does nothing (even if you'll write here some already existing text).
			  "#Map1MyText2"              "#BLANK" //The second text that will be displayed.
			  "#Map1MyTextX"              "#BLANK" //The X text that will be displayed.
		}
	}

    "map2" //The second map there we want to have credits.
	{
		"totaltime"		"100" //Total time (in seconds) we want to roll credits.
		"credits"
		 {
			  "#Map2MyText1"              "#BLANK" //The first text that will be displayed.
			  "#Map2MyText2"              "#BLANK" //The second text that will be displayed.
			  "#Map2MyTextX"              "#BLANK" //The X text that will be displayed.
		 }
    }
}

Portal lyrics

The OutroSongLyrics block holds the lyrics to the Portal games' ending songs along with timing and display information. It is formatted similarly to regular intro/outro credits, with each key being the text to display and the value being the font name, but there are various formatting characters that can be used at the start of a line to control the behavior of the text. If multiple of these are used on a single line, they must be used in the order listed.

  • A float inside square brackets ([x]) indicates how long the line will take to appear. The speed of the text will be automatically timed so it lasts this duration.
  • An integer inside a set of three less/greater symbols (<<<x>>>) will switch the active ASCII art to the one matching the specified ID. A value of zero hides the ASCII art. (only in Portal)
  • An ampersand (&) will clear the screen. This should be used on its own line with a very short display time.
  • An asterisk (*) will cause the next line of text to be displayed directly after this one, without a line break. This can be used to make different parts of a single visual line print at different speeds, which can allow matching the spoken lyrics better.
  • A caret (^) used on an otherwise blank line will force a newline to be added.
  • A hash sign (#) will look up the provided text as a localization token.

Example

"OutroSongLyrics"
{
	"[2.05]#portal_lyrics_01"         "CreditsOutroText" // brackets used for timing, hashes used for localization
	"[1.9] "                          "CreditsOutroText"
	"[2.1]#portal_lyrics_02"          "CreditsOutroText"
	"[0.1] "                          "CreditsOutroText"
	"[1.8]#portal_lyrics_03"          "CreditsOutroText"
	"[1.00] "                         "CreditsOutroText"
	"[2.36]#portal_lyrics_04"         "CreditsOutroText"
	"[0.04] "                         "CreditsOutroText"
	"[2.71]#portal_lyrics_05"         "CreditsOutroText"
	"[2.13] "                         "CreditsOutroText"
	"[1.76]<<<1>>>#portal_lyrics_06"  "CreditsOutroText" // switch ascii art
	"[2.10] "                         "CreditsOutroText"
	"[1.57]#portal_lyrics_07"         "CreditsOutroText"
	"[0.20] "                         "CreditsOutroText"
	"[0.75]*#portal_lyrics_08"        "CreditsOutroText" // combine this with the next two lines
	"[0.1]* "                         "CreditsOutroText"
	"[0.71]#portal_lyrics_09"         "CreditsOutroText"
	"[1.67] "                         "CreditsOutroText"
	"[1.55]*#portal_lyrics_10"        "CreditsOutroText" // combine with next line
	"[1.53]#portal_lyrics_11"         "CreditsOutroText"
	"[0.279] "                        "CreditsOutroText"
	"[1.741]<<<6>>>#portal_lyrics_12" "CreditsOutroText" // switch ascii art
	"[0.400]^"                        "CreditsOutroText" // force new line
	"[0.01]&"                         "CreditsOutroText" // blank screen
}

Portal ASCII art

(only in Portal) The OutroAsciiArt block defines all of the ASCII art images which can be switched between as the credits progress (see above). Despite the official credits file using a specific naming and formatting scheme for these, all of it does absolutely nothing. The game appears to simply read every subkey of OutroAsciiArt in order, and when an ASCII art index is selected, it will blindly draw 20 lines starting from the index - 1 * 20th key. This means all ASCII art must be exactly 20 lines in height, but the width can vary.

Note.pngNote:Like with names, having a closing square bracket (]) anywhere in a line will cause it and all preceding text to disappear despite this having no effect.

Example

"OutroAsciiArt"
{
	"APERTURE1" "[1.000]              .,-:;//;:=,               " // the key names here do not matter, nor do the bracketed numbers at the start of the value
	"APERTURE2" "[1.000]          . :H@@@MM@M#H/.,+%;,          "
	"APERTURE3" "[1.000]       ,/X+ +M@@M@MM%=,-%HMMM@X/,       "
	"APERTURE4" "[1.000]     -+@MM; $M@@MH+-,;XMMMM@MMMM@+-     "
	"APERTURE5" "[1.000]    ;@M@@M- XM@X;. -+XXXXXHHH@M@M#@/.   "
	"APERTURE6" "[1.000]  ,%MM@@MH ,@%=            .---=-=:=,.  "
	"APERTURE7" "[1.000]  =@#@@@MX .,              -%HX$$%%%+;  "
	"APERTURE8" "[1.000] =-./@M@M$                  .;@MMMM@MM: "
	"APERTURE9" "[1.000] X@/ -$MM/                    .+MM@@@M$ "
	"APERTURE10" "[1.000],@M@H: :@:                    . =X#@@@@-"
	"APERTURE11" "[1.000],@@@MMX, .                    /H- ;@M@M="
	"APERTURE12" "[1.000].H@@@@M@+,                    %MM+..%#$."
	"APERTURE13" "[1.000] /MMMM@MMH/.                  XM@MH; =; "
	"APERTURE14" "[1.000]  /%+%$XHH@$=              , .H@@@@MX,  "
	"APERTURE15" "[1.000]   .=--------.           -%H.,@@@@@MX,  "
	"APERTURE16" "[1.000]   .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%.   "
	"APERTURE17" "[1.000]     =XMMM@MM@MM#H;,-+HMM@M+ /MMMX=     "
	"APERTURE18" "[1.000]       =%@M@M#@$-.=$@MM@@@M; %M%=       "
	"APERTURE19" "[1.000]         ,:+$+-,/H#MMMMMMM@= =,         "
	"APERTURE20" "[1.000]               =++%%%%+/:-.             "
	"CAKE1" "[2.000]            ,:/+/-                      " // second ascii art starts exactly 20 lines down
	"CAKE2" "[2.000]            /M/              .,-=;//;-  "
	"CAKE3" "[2.000]       .:/= ;MH/,    ,=/+%$XH@MM#@:     "
	"CAKE4" "[2.000]      -$##@+$###@H@MMM#######H:.    -/H#"
	"CAKE5" "[2.000] .,H@H@ X######@ -H#####@+-     -+H###@X"
	"CAKE6" "[2.000]  .,@##H;      +XM##M/,     =%@###@X;-  "
	"CAKE7" "[2.000]X%-  :M##########$.    .:%M###@%:       "
	"CAKE8" "[2.000]M##H,   +H@@@$/-.  ,;$M###@%,          -"
	"CAKE9" "[2.000]M####M=,,---,.-%%H####M$:          ,+@##"
	"CAKE10" "[2.000]@##################@/.         :%H##@$- "
	"CAKE11" "[2.000]M###############H,         ;HM##M$=     "
	"CAKE12" "[2.000]#################.    .=$M##M$=         "
	"CAKE13" "[2.000]################H..;XM##M$=          .:+"
	"CAKE14" "[2.000]M###################@%=           =+@MH%"
	"CAKE15" "[2.000]@################M/.          =+H#X%=   "
	"CAKE16" "[2.000]=+M##############M,       -/X#X+;.      "
	"CAKE17" "[2.000]  .;XM##########H=    ,/X#H+:,          "
	"CAKE18" "[2.000]     .=+HM######M+/+HM@+=.              "
	"CAKE19" "[2.000]         ,:/%XM####H/.                  "
	"CAKE20" "[2.000]              ,.:=-.                    "
}