Closed Captions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cannot create custom captions)
Line 1: Line 1:
<div style="margin:1em auto;max-width:55em;background:#FF9F9F;padding:.5em;font-size:1.4em;border:1px solid #FF3F3F;">
<strong style="color:#FF0000;">Please note:</strong> Close captions [http://developer.valvesoftware.com/cgi-bin/bugzilla/show_bug.cgi?id=111 cannot currently be altered]. Source will only read from compiled closecaptions_<language>.dat files, but Valve have not yet released the <code>closecaptioncompile.exe</code> tool used to create them!</div>
'''Closed captions''', or subtitles, are text descriptions that accompany sound and dialogue. Their primary use is to enhance accessibility for users with audio-related difficulties, be it a disability, a hardware problem, or simply noisy surroundings. They can be enabled in the Source engine in the Audio tab of the Options dialogue box.
'''Closed captions''', or subtitles, are text descriptions that accompany sound and dialogue. Their primary use is to enhance accessibility for users with audio-related difficulties, be it a disability, a hardware problem, or simply noisy surroundings. They can be enabled in the Source engine in the Audio tab of the Options dialogue box.



Revision as of 13:55, 9 December 2007

Please note: Close captions cannot currently be altered. Source will only read from compiled closecaptions_<language>.dat files, but Valve have not yet released the closecaptioncompile.exe tool used to create them!

Closed captions, or subtitles, are text descriptions that accompany sound and dialogue. Their primary use is to enhance accessibility for users with audio-related difficulties, be it a disability, a hardware problem, or simply noisy surroundings. They can be enabled in the Source engine in the Audio tab of the Options dialogue box.

Editing closed captions

Closed captions are stored in closecaption_%language%.txt, e.g. closecaption_english.txt in the resource folder of a mod. The caption files for Half-Life 2 can be found in source engine.gcf under root/hl2/resource. To expand or edit the HL2 captions, extract this file using GCFScape and edit it.

The format of the file is:

"lang"
{ 
	"Language" "English" //(or "french", etc)
	"Tokens" 
	{ 

		// Captions defined here.
		"nameofcorrespondingsound"	"This is the caption."
		"barn.chatter"	"We're picking up radio chatter. They're looking for your car. "
		// ...

	}
}

As indicated, the first half of a caption-defining line is the name of a sound token. This should correspond to a sound defined in one of the sound files listed in modname/scripts/game_sounds_manifest.txt. E.g. barn.chatter is defined in hl2/scripts/level_sounds_coast.txt.

Note.pngNote:Be careful of which program you choose to edit this file with. Some text editors can change the formatting of the file, which will cause Source to reject the closed captions file and no closed captions will display. Notepad with word wrap turned off works fine. Others do not.

Using closed captions with no attached dialogue or sounds

Recording dialogue is a very resource-expensive process. If, once dialogue has been recorded, you decide you want to change something, making those changes can prove very costly, so final dialogue recording is often best done as one of the final stages in a project.

However, while creating choreographed scenes, it is highly desirable to have the dialogue available as early as possible. One way around this conflict is for the developer to record their own placeholder audio, but even this can take up significant amounts of time. A cheaper way of creating placeholder dialogue is to use closed captions without any attached dialogue.

There are three steps involved in accomplishing this:

1. Creating the captions

Sound tokens (e.g. barn.chatter above) can have closed captions attached without corresponding entries in the sound manifest. To create new closed captions, simply add new entries to the closecaption_english.txt (or other language file), as described above.

2. Adding the captions in Faceposer

In Faceposer, dialogue-free closed captions are added in the same way normal dialogue is added (right-click on the timeline and choose WAV File...). However, because the closed caption tokens are not in the sound manifest, they will not appear on the list of available sounds. Instead, simply refer to the entries you added in step 1 and type the token name manually into the Sound textbox.

3. Setting the length of caption appearance time

Once the first two steps are complete, your scenes will display the closed captions when they are played in game (as long as closed captions are turned on in the game options, of course). However, because there is no associated sound file, the event has no length. This means that the closed captions will leave the screen almost as soon as they are displayed, leaving a player little time to read them. While this is acceptable for captions comprised of one or two words, some more work is required to keep longer captions up on screen for a sufficient amount of time.

Faceposer doesn't support editing the length of WAV file events, but they can be edited through manual editing of the .vcd file. Open the .vcd in Notepad and find the speak event you wish to change the length of. A search for the name of the speak event will take you to the right place in the file.

There you will find an entry like this one:

event speak "Test"
{
	time 1.000000 -1.000000
	param "test.test"
	fixedlength
	cctype "cc_master"
	cctoken ""
}

The time line denotes the start and end time of the event. The end time is set to -1.000000 because the speak event currently has no length. Edit this number to be the time (in seconds, on the timeline) when you wish the closed caption to end and save the file.

Obviously the desired length of time that a caption appears for will differ depending on the length of text. In general, when trying to decide how long text should appear on screen for, a good first estimate can often be achieved by timing yourself reading the text aloud and then doubling that number, to account for its unfamiliarity to fresh eyes.

Note.pngNote:You may find it useful to include a logic_auto and a point_clientcommand in your map, set to issue the console command closecaption 1 on map load. This will ensure that you don't need to remind anyone using your mod (e.g. other team members) to turn on their captions.
Warning.pngWarning:As a final note, this method could charitably be described as "experimental" and less charitably as a hack. As with all hacks, there exists the possibility that unpredictable and unexpected behaviour will be introduced. It is recommended that you make backups of your .vcd's before manually editing them, and keep regular backups of your .vcd's, lest Faceposer undo those edits suddenly.

See Also