Zh/Closed Captions: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
 
(26 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{otherlang2
{{LanguageBar|title = 隐藏式字幕}}
|title=隐藏式字幕
 
|en=Closed_Captions
[[File:Closed captions.jpg|thumb|300px|{{L|Half-Life 2|《半条命 2》}}中的隐藏式字幕。布林博士预先录制的演讲没有很清晰,因为它没有那么重要。]]
}}
[[File:Closed captions.jpg|thumb|300px|[[Half-Life 2|《半条命 2》]]中的隐藏式字幕。布林博士预先录制的演讲没有很清晰,因为它没有那么重要。]]


'''隐藏式字幕''',或者字幕,是伴随声音和对话而出现的文本描述。它们可以提示那些听力存在障碍的玩家,在一定程度上也提示玩家周围正在发生什么。通过一些巧妙的设计,它们还可以用来显示尚未录制的对话。
'''隐藏式字幕''',或者字幕,是伴随声音和对话而出现的文本描述。它们可以提示那些听力存在障碍的玩家,在一定程度上也提示玩家周围正在发生什么。通过一些巧妙的设计,它们还可以用来显示尚未录制的对话。
Line 9: Line 7:
可以在起源引擎游戏的“选项”>“音频”里启用对话字幕或者完全字幕。
可以在起源引擎游戏的“选项”>“音频”里启用对话字幕或者完全字幕。


[[soundscript|声音脚本]]和<code>scripts/[[Sentences.txt |sentences.txt]]</code>中定义的声音都可以制作成字幕。
{{L|soundscript|声音脚本}}和<code>scripts/{{L|Sentences.txt|sentences.txt}}</code>中定义的声音都可以制作成字幕。


==编辑隐藏式字幕==
==编辑隐藏式字幕==
Closed captions are stored in <code>closecaption_%language%.dat</code> (e.g. ''closecaption_english.dat'') in <code><game dir>\resource\</code>. A .dat file is binary file compiled from a corresponding .txt file by the <code>captioncompiler</code> tool.
隐藏式字幕储存在 <code>closecaption_%语言%.dat</code> 中(例如 ''closecaption_english.dat''),路径为 <code><游戏目录>\resource\</code>。一个 .dat 文件是由 <code>captioncompiler</code> 工具从相应的 .txt 文件编译而成的二进制文件。
尽管引擎不会从文本文件中读取字幕,Valve 还是提供了他们的源文件以供模组制作者使用。你可以在你的 <code>resource\</code> 文件夹中或者 {{L|VPK}} 文件中找到这些文件。


Although the engine does not read from the text file, Valve provided their originals for use by modders. You can find them in your <code>resource\</code> folder or possibly in the [[VPK]]s.
文本文件的格式为:
 
The format of the text file is:


<source lang=php>
<source lang=php>
Line 25: Line 22:
{  
{  
//这里开始编写字幕。
//这里开始编写字幕。
nameofsound "这是字幕文本。"
音效名称 "这是字幕文本。"


barn.chatter "We're picking up radio chatter. They're looking for your car."
barn.chatter "We're picking up radio chatter. They're looking for your car."
Line 33: Line 30:
</source>
</source>


* The text file must be saved in the ''UCS-2 Little Endian'' format.
* 文本文件必须以“''UCS-2 Little Endian''”的编码格式保存。
* The name of the sound must be something defined in your [[soundscript]]s, not a raw filename.
* 音效名称必须是在你的{{L|soundscript|音效脚本}}里定义的音效,而不是音频的原始文件名。
* Remember to wrap "quote marks" around any block of data containing whitespace.
* 记得在有空格的数据块两边加上英文双引号。




Example for sentences.txt:
以下是一个 sentences.txt 的例子:


<source lang=php>
<source lang=php>
nameofsound soundfile {captioncodehere closecaption nameofsound}
音效名称 声音文件 {字幕代码 closecaption 音效名称}


BA_LATE barney/c1a0_ba_late {Len 2.33 closecaption BA_LATE}
BA_LATE barney/c1a0_ba_late {Len 2.33 closecaption BA_LATE}
Line 48: Line 45:
===字幕代码===
===字幕代码===


;<code><sfx></code>: Marks a line as a sound effect that will only be displayed with full closed captioning. If the user has cc_subtitles set to "1", it will not display these lines.
;<code><sfx></code>: 把字幕标记为音效字幕,只能在“显示完全字幕”启用的情况下出现。如果玩家将 cc_subtitles 设置为“1”,就不会出现这些字幕。
;<code><clr:255,255,255></code>: Sets the color of the caption using RGB color; 0 is no color, 255 is full color. For example, ;<code><clr:255,255,255></code> would be white.
;<code><clr:255,255,255></code>: 使用 RGB 设置字幕的颜色,0 表示无色,255 表示全色。比如<code><clr:255,255,255></code>表示白色。
;<code><playerclr:255,176,0:255,255,255></code>: Sets the RGB color of the caption depending on whether it is coming from the player/client or not. The first color is for when the sound is emitted by the player and the second color is for when it is emitted by anything or anyone else, separated by colon. For example, <code><playerclr:255,176,0:255,255,255></code> would be orange when the sound is emitted by the player or their equipment and white when emitted by anything else.
;<code><playerclr:255,176,0:255,255,255></code>: 基于是否由玩家/客户端发出的声音来设置 RGB 颜色。第一个颜色代码是当音效为玩家所发出时,字幕的颜色。第二个颜色代码是当音效为非玩家所发出时,字幕的颜色。用冒号分隔。举个例子,<code><playerclr:255,176,0:255,255,255></code>当声音是由玩家或玩家的武器发出的,字幕为橙色,由其它东西发出的,为白色。
;<code><nowiki><B></nowiki></code>: Bolds all text following the tag.
;<code><nowiki><B></nowiki></code>: 加粗该标记后面的所有文本。
;<code><nowiki><I></nowiki></code>: Italics text following the tag. {{note|<code><nowiki><B></nowiki></code> and <code><nowiki><I></nowiki></code> can both be undone in the same line. "<code><nowiki>This is <B>bold text!<B> This is unbold.</nowiki></code>" would look like this: This is '''bold text!''' This is unbold.}}
;<code><nowiki><I></nowiki></code>: 将标记后面的文本变成斜体。{{note|<code><nowiki><B></nowiki></code> <code><nowiki><I></nowiki></code> 都可以在同一行内取消。"<code><nowiki>这是<B>粗体!<B>这是非粗体。</nowiki></code>" 看起来就像这样:这是'''粗体!'''这是非粗体。}}
;<code><norepeat:15></code>: Controls how often a line can be repeated. If set to 15, this line won't be repeated in the next 15 seconds.
;<code><norepeat:15></code>: 控制字幕出现的频率。如果设置为 15,则表示这行字幕在出现后 15 秒之内不会重复出现。
;<code><len:5></code>: Overrides how long the line will display. For example, <code><len:5></code> will make the caption stay on the screen for 5 seconds. Without this, they stay for the duration of the sound + the time stored in the <code>cc_linger_time</code> convar.
;<code><len:5></code>: 设置字幕的持续时间。举个例子,<code><len:5></code>会让字幕在屏幕上持续 5 秒钟。如果不添加此代码,字幕的持续时间为“音频时长+<code>cc_linger_time</code>命令的参数”。
;<code><cr></code>: Manually adds a new line for any further text in the caption.
;<code><cr></code>: 为字幕手动添加一个空行。
: ''For example, "Occupation:<cr>Subtitles"'' =
: ''举个例子,"功能:<cr>字幕"''等同于
: <code>Occupation:
: <code>功能:
: Subtitles</code>
: 字幕</code>
;<code><delay:2></code>: Sets a delay in between caption text, automatically adding a new line clearing all formatting. For example, with <code><nowiki>"<i><clr:255,176,0>HEV enabled.<delay:3>Your HEV was enabled."</nowiki></code>, "HEV enabled" will appear in italics and an orange color. 3 seconds later, "Your HEV was enabled" will emerge below it without any formatting from the previous line. The new line will always be directly below the previous one even if there are other captions below it.
;<code><delay:2></code>: 设置字幕文本出现的延迟,自动换行并且清除所有格式。举个例子,在<code><nowiki><i><clr:255,176,0>HEV 已启动。<delay:3>你的 HEV 已经启动。”</nowiki></code>中,“HEV 已启动”将会以橙色斜体的样子出现。3 秒钟后,“你的 HEV 已经启动”将出现在它下面,而不使用上一行的任何格式。新行总是在前一行的正下方,即使下面有其他字幕。


===编译===
===编译===
The captions must be compiled with <code>captioncompiler.exe</code>. Since the caption file must be dragged from the mod resource directory in order to produce the .dat file. e.g. <code>C:\Program Files\Steam\steamapps\SourceMods\[mod name]\resource\</code>, this process will become slightly easier if you create a batch command file in the resource folder. Copy the following code into a text file and save it as a .bat file in the resources folder:
字幕文件必须使用 <code>captioncompiler.exe</code> 进行编译。且需要编译的字幕文件必须位于模组的 resource 文件夹,这样才能够生成 .dat 文件。 举个例子 <code>C:\Program Files\Steam\steamapps\SourceMods\[模组名称]\resource\</code>,如果在 resource 文件夹中创建批处理命令文件,此过程将变得稍微容易一些。将以下代码复制到文本文件中,并将其另存为 .bat 文件:


<syntaxhighlight lang=winbatch>
<syntaxhighlight lang=winbatch>
Line 69: Line 66:
</syntaxhighlight>
</syntaxhighlight>


{{tip|With a batch file, you can use the <code>-game "path to [[mod folder]]"</code> parameter to override the global [[Game Directory|vproject]] value.  Place it after <code>%1</code>, leaving a space. This saves you from having to launch the SDK and change it there.}}
{{tip|对于批处理文件,你可以使用 <code>-game “{{L|模组文件夹}}的路径”</code> 参数来覆盖全局 {{L|Game Directory|vproject}} 环境变量。把它放置在 <code>%1</code> 后面,输入一个空格。这样你就无需启动 SDK 并在那里更改环境变量了。}}


{{note|All the filepaths in this file should be '''absolute''', meaning they start at <code>C:\</code>.}}
{{note|此文件中的所有文件路径都应该是“'''绝对'''”的,这意味着它们从<code>C:\</code>开始。}}


{{note|Depending on the engine branch, one might change the location of the exe indicated at the batch file into other folders, as the compiled .dat file might not be compatible with such version.}}
{{note|根据引擎分支的不同,可能会将批处理文件中指示的 exe 文件的位置更改到其他文件夹中,因为编译的 .dat 文件可能与此类版本不兼容。}}
{{note|字幕源文件的位置必须相对于<code>-game</code>参数指定的游戏目录,否则编译器将无法识别}}
将你的字幕 .txt 文件拖到批处理文件上,以便像使用 .exe 本身一样使用它。


Drag your caption .txt files onto the Batch file to use it as you would the .exe itself.
==在你的地图里播放带有字幕的音频==
有时候,当玩家激活了一个触发器时,你也许想要播放带有字幕的音频。不幸的是,{{ent|ambient_generic}} 的“Play Everywhere(到处播放)”标签对于 {{L|Soundscripts|soundscripts}} 来说是损坏的,因为字幕只能在音效脚本和 {{L|Sentences.txt|sentences.txt}} 中使用(除了解说音频节点,详情请参加[[Commentary_System#Subtitles |这里]])。因此,你必须进行一些修改:使用 {{ent|point_clientcommand}} 实体执行三个命令:


== Playing sounds in your map with closed captions ==
* {{ent|play|音频文件的路径}}
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 | soundscripts]], and subtitles only work on soundscripts and in [[Sentences.txt | sentences.txt]] (except for commentary nodes, see [[Commentary_System#Subtitles | here]]). Hence you'll have to do a bit of a hack: use [[point_clientcommand]] to execute three commands:
* {{ent|cc_linger_time|'''X'''}},其中“X”是手动调整的参数。
* {{ent|cc_emit|'''字幕名称'''}},其中“字幕名称”是隐藏式字幕文件中的键值。


* play path/to/sound/file
确保 '''{{ent|closecaption|1}}''' '''{{ent|cc_subtitles|1}}''' 都已设置。
* 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''' and '''cc_subtitles''' are set to 1.
==没有音频的字幕==


== Captions without 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.创建字幕
:声音标记(例如上面的 <code>barn.chatter</code>)可以为在音效列表中没有的音效脚本添加隐藏式字幕。要创建新的隐藏式字幕,只需将新条目添加到“closecaption_schinese.txt”(或其他语言文件)中,如[[Closed Captions#编辑隐藏式字幕|上文所述]]。
;2.在 Faceposer 中添加字幕
:在 Faceposer 中,添加无对话的隐藏式字幕的方式与添加普通对话的方式相同(右键单击时间线并选择 <code>WAV File…</code>)。但是,由于隐藏式字幕标记不在音效列表中,因此它们不会出现在可用声音列表中。相反,只需参考你在步骤 1 中添加的条目,并在 <code>Sound</code> 文本框中手动键入标记名称即可。
;3.设置字幕的出现时长
:前两步完成后,在游戏中播放时,场景将显示隐藏式字幕(当然,需要在游戏选项中打开隐藏式字幕)。但是,由于没有关联的声音文件,因此事件没有长度。这意味着隐藏式字幕几乎一显示就消失,只给玩家一点点时间阅读。虽然这对于由一个或两个单词组成的字幕来说是可以接受的,但需要做更多的工作才能让字幕保持较长以方便阅读。


;1. Creating the captions
Faceposer 不支持编辑 WAV 文件事件的长度,但可以通过手动编辑 <code>.vcd</code> 文件来更改它们。用记事本打开 <code>.vcd</code>,找到要更改长度的演讲事件。搜索 speak 事件的名称会将你跳转到文件中的指定位置。
:Sound tokens (e.g. <code>barn.chatter</code> 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 [[Closed Captions#Editing closed captions|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 <code>WAV File...</code>). 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 <code>Sound</code> 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 <code>.vcd</code> file. Open the <code>.vcd</code> 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"
  event speak "Test"
Line 114: Line 111:
  }
  }


The <code>time</code> line denotes the start and end time of the event. The end time is set to <code>-1.000000</code> 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.
<code>time</code> 行表示事件的开始和结束时间。结束时间设置为 <code>-1.000000</code> 是因为该 speak 事件当前没有长度。将此数值更改为你想要字幕消失的时间(在时间线上,以秒为单位),然后就可以保存文件退出了。


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|You may find it useful to include a [[logic_auto]] and a [[point_clientcommand]] in your map, set to issue the console command <code>closecaption 1</code> 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.}}
{{note|你可能会发现在地图里添加一个 {{ent|logic_auto}} 和一个 {{ent|point_clientcommand}} 非常有用,设置为在地图加载时发出控制台命令 {{ent|closecaption|1}}。这样可以让你不需要提醒使用你的模组的任何人(例如其他团队成员)自己去打开他们的字幕。}}


{{warning|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 <code>.vcd</code>'s before manually editing them, and keep regular backups of your <code>.vcd</code>'s, lest Faceposer undo those edits suddenly.}}
{{warning|最后一点,这种方法可以被恰当地描述为“实验性的”,而不是不那么恰当地描述为修改。与所有修改一样,存在导致不可预测和意外行为的可能性。建议你在手动编辑 <code>.vcd</code> 之前对其进行备份,并定期备份 <code>.vcd</code>,以免 Faceposer 突然撤消这些编辑。}}


==为 BINK 视频制作字幕==
==为 BINK 视频制作字幕==


随着[[Left 4 Dead|《求生之路》]]的发布,现在可以为 Bink 视频制作字幕。
随着《{{l4d|4}}》的发布,现在可以为 Bink 视频制作字幕。


==注意事项==
==注意事项==
在''《求生之路 2》''以及之后的游戏中,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>.
在''《{{l4d2|4}}》''以及之后的游戏中,Valve 使用 subtitles_language 作为主要的字幕文件,而不是将字幕保存在''带有''“听力障碍”字幕的 closecaption_语言文件中。这可能是因为“隐藏式字幕”是为了方便听力受损者。而就目的来说,“Subtitles(字幕)”是一个更容易被接受的术语,不过,其中的音效仍然可以被标记为 <sfx>


==另见==
==另见==
* [[Other FacePoser Tools|其他 FacePoser 工具]]
* {{L|Other FacePoser Tools|其他 FacePoser 工具}}
* Closed caption related console commands are prefixed with <code>cc_</code>. See [[Console Command List]] for a full list.
* 与隐藏式字幕相关的控制台命令的前缀为<code>cc_</code>。有关完整列表,请参见 {{L|Console Command List}}
 
{{SDKTools}}
{{SDKTools}}
 
{{ACategory|Choreography}}
[[Category:Choreography]]
{{ACategory|Plain text files}}
{{ACategory|Plain text formats}}

Latest revision as of 20:09, 29 January 2025

English (en)中文 (zh)Translate (Translate)
《半条命 2》(en)中的隐藏式字幕。布林博士预先录制的演讲没有很清晰,因为它没有那么重要。

隐藏式字幕,或者字幕,是伴随声音和对话而出现的文本描述。它们可以提示那些听力存在障碍的玩家,在一定程度上也提示玩家周围正在发生什么。通过一些巧妙的设计,它们还可以用来显示尚未录制的对话。

可以在起源引擎游戏的“选项”>“音频”里启用对话字幕或者完全字幕。

声音脚本(en)scripts/sentences.txt(en)中定义的声音都可以制作成字幕。

编辑隐藏式字幕

隐藏式字幕储存在 closecaption_%语言%.dat 中(例如 closecaption_english.dat),路径为 <游戏目录>\resource\。一个 .dat 文件是由 captioncompiler 工具从相应的 .txt 文件编译而成的二进制文件。 尽管引擎不会从文本文件中读取字幕,Valve 还是提供了他们的源文件以供模组制作者使用。你可以在你的 resource\ 文件夹中或者 VPK(en) 文件中找到这些文件。

文本文件的格式为:

lang
{ 
	Language "English" //设置为“英语”(或者“schinese”代表简体中文,以及其他语言...)
	Tokens 
	{ 
		//这里开始编写字幕。
		音效名称	"这是字幕文本。"

		barn.chatter	"We're picking up radio chatter. They're looking for your car."
		//以此类推...
	}
}
  • 文本文件必须以“UCS-2 Little Endian”的编码格式保存。
  • 音效名称必须是在你的音效脚本(en)里定义的音效,而不是音频的原始文件名。
  • 记得在有空格的数据块两边加上英文双引号。


以下是一个 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>
将标记后面的文本变成斜体。
Note.png注意:<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
Tip.png提示:对于批处理文件,你可以使用 -game “模组文件夹(en)的路径” 参数来覆盖全局 vproject(en) 环境变量。把它放置在 %1 后面,输入一个空格。这样你就无需启动 SDK 并在那里更改环境变量了。
Note.png注意:此文件中的所有文件路径都应该是“绝对”的,这意味着它们从C:\开始。
Note.png注意:根据引擎分支的不同,可能会将批处理文件中指示的 exe 文件的位置更改到其他文件夹中,因为编译的 .dat 文件可能与此类版本不兼容。
Note.png注意:字幕源文件的位置必须相对于-game参数指定的游戏目录,否则编译器将无法识别

将你的字幕 .txt 文件拖到批处理文件上,以便像使用 .exe 本身一样使用它。

在你的地图里播放带有字幕的音频

有时候,当玩家激活了一个触发器时,你也许想要播放带有字幕的音频。不幸的是,ambient_generic 的“Play Everywhere(到处播放)”标签对于 soundscripts(en) 来说是损坏的,因为字幕只能在音效脚本和 sentences.txt(en) 中使用(除了解说音频节点,详情请参加这里)。因此,你必须进行一些修改:使用 point_clientcommand 实体执行三个命令:

  • play 音频文件的路径
  • cc_linger_time X,其中“X”是手动调整的参数。
  • cc_emit 字幕名称,其中“字幕名称”是隐藏式字幕文件中的键值。

确保 closecaption 1cc_subtitles 1 都已设置。

没有音频的字幕

录制对话是一个非常耗费资源的过程。如果对话录制完成后,您决定要更改某些内容,那么进行这些更改的成本将非常高,因此,最终对话录制通常是项目的最后阶段之一。

然而,在创作编排好的场景时,尽早提供对话是非常可取的。解决此问题的一种方法是开发人员录制自己的占位符音频,但即使这样也会占用大量时间。创建占位符对话的一种更廉价的方法是使用隐藏式字幕,而不附加任何对话音频。

实现这一点需要三个步骤:

1.创建字幕
声音标记(例如上面的 barn.chatter)可以为在音效列表中没有的音效脚本添加隐藏式字幕。要创建新的隐藏式字幕,只需将新条目添加到“closecaption_schinese.txt”(或其他语言文件)中,如上文所述
2.在 Faceposer 中添加字幕
在 Faceposer 中,添加无对话的隐藏式字幕的方式与添加普通对话的方式相同(右键单击时间线并选择 WAV File…)。但是,由于隐藏式字幕标记不在音效列表中,因此它们不会出现在可用声音列表中。相反,只需参考你在步骤 1 中添加的条目,并在 Sound 文本框中手动键入标记名称即可。
3.设置字幕的出现时长
前两步完成后,在游戏中播放时,场景将显示隐藏式字幕(当然,需要在游戏选项中打开隐藏式字幕)。但是,由于没有关联的声音文件,因此事件没有长度。这意味着隐藏式字幕几乎一显示就消失,只给玩家一点点时间阅读。虽然这对于由一个或两个单词组成的字幕来说是可以接受的,但需要做更多的工作才能让字幕保持较长以方便阅读。

Faceposer 不支持编辑 WAV 文件事件的长度,但可以通过手动编辑 .vcd 文件来更改它们。用记事本打开 .vcd,找到要更改长度的演讲事件。搜索 speak 事件的名称会将你跳转到文件中的指定位置。

在这里,你会发现一个类似以下内容的条目:

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

time 行表示事件的开始和结束时间。结束时间设置为 -1.000000 是因为该 speak 事件当前没有长度。将此数值更改为你想要字幕消失的时间(在时间线上,以秒为单位),然后就可以保存文件退出了。

显然,字幕显示的所需时间长度因文本长度而异。一般来说,当试图确定文本应该在屏幕上显示多长时间时,一种比较好的方法是你自己计时朗读文本,然后把读完所需的时间加倍,以便于阅读速度不是很快的人能够读完字幕。

Note.png注意:你可能会发现在地图里添加一个 logic_auto 和一个 point_clientcommand 非常有用,设置为在地图加载时发出控制台命令 closecaption 1。这样可以让你不需要提醒使用你的模组的任何人(例如其他团队成员)自己去打开他们的字幕。
Warning.png警告:最后一点,这种方法可以被恰当地描述为“实验性的”,而不是不那么恰当地描述为修改。与所有修改一样,存在导致不可预测和意外行为的可能性。建议你在手动编辑 .vcd 之前对其进行备份,并定期备份 .vcd,以免 Faceposer 突然撤消这些编辑。

为 BINK 视频制作字幕

随着《求生之路 求生之路》的发布,现在可以为 Bink 视频制作字幕。

注意事项

求生之路2 求生之路2以及之后的游戏中,Valve 使用 subtitles_language 作为主要的字幕文件,而不是将字幕保存在带有“听力障碍”字幕的 closecaption_语言文件中。这可能是因为“隐藏式字幕”是为了方便听力受损者。而就目的来说,“Subtitles(字幕)”是一个更容易被接受的术语,不过,其中的音效仍然可以被标记为 <sfx>。

另见