隐藏式字幕

隐藏式字幕,或者字幕,是伴随声音和对话而出现的文本描述。它们可以提示那些听力存在障碍的玩家,在一定程度上也提示玩家周围正在发生什么。通过一些巧妙的设计,它们还可以用来显示尚未录制的对话。
可以在起源引擎游戏的“选项”>“音频”里启用对话字幕或者完全字幕。
在声音脚本和scripts/sentences.txt
中定义的声音都可以制作成字幕。
编辑隐藏式字幕
隐藏式字幕储存在 closecaption_%语言%.dat
中(例如 closecaption_english.dat),路径为 <游戏目录>\resource\
。一个 .dat 文件是由 captioncompiler
工具从相应的 .txt 文件编译而成的二进制文件。
尽管引擎不会从文本文件中读取字幕,Valve 还是提供了他们的源文件以供模组制作者使用。你可以在你的 resource\
文件夹中或者 VPK 文件中找到这些文件。
文本文件的格式为:
lang
{
Language "English" //设置为“英语”(或者“schinese”代表简体中文,以及其他语言...)
Tokens
{
//这里开始编写字幕。
音效名称 "这是字幕文本。"
barn.chatter "We're picking up radio chatter. They're looking for your car."
//以此类推...
}
}
- 文本文件必须以“UCS-2 Little Endian”的编码格式保存。
- 音效名称必须是在你的音效脚本里定义的音效,而不是音频的原始文件名。
- 记得在有空格的数据块两边加上英文双引号。
以下是一个 sentences.txt 的例子:
音效名称 声音文件 {字幕代码 closecaption 音效名称}
BA_LATE barney/c1a0_ba_late {Len 2.33 closecaption BA_LATE}
字幕代码
<sfx>
- 把字幕标记为音效字幕,只能在“显示完全字幕”启用的情况下出现。如果玩家将 cc_subtitles 设置为“1”,就不会出现这些字幕。
<clr:255,255,255>
- 使用 RGB 设置字幕的颜色,0 表示无色,255 表示全色。比如
<clr:255,255,255>
表示白色。 <playerclr:255,176,0:255,255,255>
- 基于是否由玩家/客户端发出的声音来设置 RGB 颜色。第一个颜色代码是当音效为玩家所发出时,字幕的颜色。第二个颜色代码是当音效为非玩家所发出时,字幕的颜色。用冒号分隔。举个例子,
<playerclr:255,176,0:255,255,255>
当声音是由玩家或玩家的武器发出的,字幕为橙色,由其它东西发出的,为白色。 <B>
- 加粗该标记后面的所有文本。
<I>
- 将标记后面的文本变成斜体。
注意:
<B>
和<I>
都可以在同一行内取消。"这是<B>粗体!<B>这是非粗体。
" 看起来就像这样:这是粗体!这是非粗体。 <norepeat:15>
- 控制字幕出现的频率。如果设置为 15,则表示这行字幕在出现后 15 秒之内不会重复出现。
<len:5>
- 设置字幕的持续时间。举个例子,
<len:5>
会让字幕在屏幕上持续 5 秒钟。如果不添加此代码,字幕的持续时间为“音频时长+cc_linger_time
命令的参数”。 <cr>
- 为字幕手动添加一个空行。
- 举个例子,"功能:<cr>字幕"等同于
功能:
字幕
<delay:2>
- 设置字幕文本出现的延迟,自动换行并且清除所有格式。举个例子,在
“<i><clr:255,176,0>HEV 已启动。<delay:3>你的 HEV 已经启动。”
中,“HEV 已启动”将会以橙色斜体的样子出现。3 秒钟后,“你的 HEV 已经启动”将出现在它下面,而不使用上一行的任何格式。新行总是在前一行的正下方,即使下面有其他字幕。
编译
字幕文件必须使用 captioncompiler.exe
进行编译。且需要编译的字幕文件必须位于模组的 resource 文件夹,这样才能够生成 .dat 文件。 举个例子 C:\Program Files\Steam\steamapps\SourceMods\[模组名称]\resource\
,如果在 resource 文件夹中创建批处理命令文件,此过程将变得稍微容易一些。将以下代码复制到文本文件中,并将其另存为 .bat 文件:
"C:\Program Files (x86)\Steam\steamapps\common\Half-Life 2\bin\captioncompiler.exe" %1
pause
将你的字幕 .txt 文件拖到批处理文件上,以便像使用 .exe 本身一样使用它。
在你的地图里播放带有字幕的音频
Sometimes, you may want to play a sound with closed captions (or subtitles, really) when the player activates a trigger. Unfortunately, ambient_generic's "Play Everywhere" flag is broken for soundscripts, and subtitles only work on soundscripts and in sentences.txt (except for commentary nodes, see here). Hence you'll have to do a bit of a hack: use point_clientcommand to execute three commands:
- play path/to/sound/file
- cc_linger_time X, where X is a manually-tweaked value.
- cc_emit commentaryFileName, where commentaryFileName is a key from the closed captions text file.
Make sure both closecaption 1 and cc_subtitles 1 are set.
没有音频的字幕
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 theSound
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.
为 BINK 视频制作字幕
随着《Template:Game name》的发布,现在可以为 Bink 视频制作字幕。
注意事项
在《Template:Game name》以及之后的游戏中,Valve 使用 subtitles_language 作为字幕文件for the subtitles instead of keeping them in the closecaption_language files with the "hearing impaired" captions. The probable reasoning for this is because "closed captions" is for the hearing impaired, and for convenience. "Subtitles" is a more accepted term to use for this entity's purpose. Though, the sounds can still be marked as <sfx>.
另见
- 其他 FacePoser 工具
- Closed caption related console commands are prefixed with
cc_
. See Console Command List for a full list.
|