版本

menu_open

限制对象的播放实例

在游戏资源紧张或受游戏设计所限的情况下,您必须优化游戏内同时播放的对象。您可以通过以下方法,管理工程内同时播放的各种对象:

  • Limiting the number of instances that can be played per game object or globally on one or more Actor-Mixer Hierarchy or Interactive Music Hierarchy objects and their children;

  • 限制可通过特定总线的对象总数;或

  • 限制整个游戏中的对象总数。

达到限制后,Wwise 将使用对象的优先级设置,根据达到限制时所设置的行为,决定忽略哪个对象。如果对象具有相同的优先级,那么可以选择忽略最新的实例,还是忽略最早的实例。

当您在 Actor-Mixer 层级或 Interactive Music 层级设置播放数限制时,您可以针对全局或各个游戏对象来控制同一结构能够被播放的实例数量。If a child object ignores the playback limit set at the parent level, it is no longer part of the limit hierarchy. Instead, the total number of instances that can play is their sum. This means that if, for example, you have a parent with a limit of 20 and a child object set to Ignore parent with a limit of 10, the total possible number of instances is 30. If, however, the child were not set to Ignore parent, then the total possible number of instances would be 20, the same as the parent. As seen in the illustration below, limits can be placed on child objects whether or not the parent is ignored. This allows for minute playback control over the maximum number of instances for a particular object and its descendants.

在 Master-Mixer 层级中设置播放数限制时,可以指定同时能够通过该总线的声音、音乐或振动的数量。由于各个对象的优先级已经在角色混音器或 Interactive Music 层级上进行了指定,因此总线上不存在播放优先级设置。

在工程/游戏层面上设置播放数限制时,可指定同时处于激活状态的对象数量。 各个声音将采用在其 Advanced Settings 中设置的虚声部行为。

定义播放数限制的方法是:

  1. 选择对象,将其加载到 Property Editor 中。

  2. 切换至 Advanced Settings 选项卡。

  3. Playback Limit 分组框中,选择 Limit sound instances to 选项。

    各播放数限制参数变为可用。

  4. 在对应的文本框中,输入每个游戏对象可同时播放的最大数量。

  5. 要定义播放数限制的范围,请选择以下任一选项:

    • Global,针对全局范围应用限制。

    • Per game object,针对每个游戏对象应用限制。

    [注意] 注意

    该选项不适用于总线,因为此限制总是适用于全局范围。

  6. 要决定达到播放上限时执行何种操作,请选择以下任一项:

    • Kill voice,停止播放具有最低优先级的实例。

    • Use virtual settings,对声音采用指定的虚声部行为。The sounds' virtual behaviors are Continue to play, Kill voice, Send to virtual voice, and Kill if finite else virtual.

  7. To determine what happens when the Playback Limit is reached and there is more than one object with the lowest priority, select one of the following options from the When priority is equal list:

    • Discard oldest instance,停止播放具有最低优先级的最早实例。

    • Discard newest instance,停止播放具有最低优先级的最新实例。

  8. 工程/游戏限制可以在 Wwise Project Settings 中针对各个平台修改。也可以在游戏正确初始化引擎后,使用 Wwise SDK API 进行修改。

使用声部限制系统时,最好了解以下几点:

  • 虚声部不会被视为有效声部。

  • 虚声部设置为Continue to play的声音可能会导致声音数超出上限。

  • Sounds that are sent to virtual voice can normally be set to Play from beginning, Play from elapsed time, or Resume upon return to physical voice (no longer virtual). However, in the case of the Kill if finite else virtual option, sounds that are sent to virtual voice are always set to Play from elapsed time upon return to physical voice.

例如,我们假设:

  • 总线上的限制设置为同时播放 4 个声音。

  • The When limit is reached behavior on this bus is set to Use virtual voice settings.

  • 音量阈值设置为 -60 dB。

  • 该总线在一帧中播放了 8 个声部。

声音名称

Priority

Volume

虚声部行为

Sound_1

100

0 dB

Go Virtual

Sound_2

90

-90 dB

Go Virtual

Sound_3

80

-90 dB

Continue to play(继续播放)

Sound_4

70

0 dB

Go Virtual

Sound_5

60

0 dB

Kill voice

Sound_6

50

0 dB

Kill voice

Sound_7

40

0 dB

Go Virtual

Sound_8

30

0 dB

Continue to play(继续播放)

结果是:

声音名称

结果

原因

Sound_1

播放 (1/4)

最高优先级且高于音量阈值。

Sound_2

将变为虚拟

音量低于阈值。

Sound_3

播放 (2/4)

即使低于音量阈值也继续播放。

Sound_4

播放 (3/4)

-

Sound_5

播放 (4/4)

-

Sound_6

将被终止

超出限制,已有 4 个优先级较高的声音正在播放

Sound_7

将变为虚拟

超出限制,已有 4 个优先级较高的声音正在播放

Sound_8

播放 (5/4)*

*即使超出限制但仍播放,这是一种特殊的情形,不允许声音变为虚拟或被终止,且不允许替代 4 个正在播放并且优先级较高的声音。

常见问题

问:限制好像不起作用?这是为什么?

答:检查是否未将声音的虚声部行为设置为Continue to play,,处于兼容性原因,这是该行为的默认值。超出限制时,使用该设置的任何声音将不会被忽略,也不会被移至虚声部(除非超出限制行为被设置为终止声部)。开始使用Use virtual voice settings 作为超出限制选项时,必须将所有“可去掉”或“可虚拟化”的声音设置为此选项,以开始节省 CPU。

Also keep in mind that the limit applies only to sound objects that are within the selected object's hierarchy. If a child object has the Ignore Parent option enabled, it is no longer part of that limiter hierarchy and is not controlled by the parent's limit.


问:该限制在大部分时间都起作用,但有时即使没有任何声音被设置为Continue to play,性能分析显示的值仍超出限制。

答:当声音变为虚声部后,这些声音会在几毫秒内(一个音频帧)保持激活状态,才能淡出并避免出现 clicking。例如,如果发声数限制被设置为 1,并且当前正在播放一个声音,这是另一个具有较高优先级的声音开始播放,那么当第一个声音淡出并变为虚声部时,活跃声部的数量将临时变为 2。


问:为什么当超出限制时发送至虚声部不是默认设置?为什么默认情况下所有声音别设置为继续播放?

A: Some source codecs may not be perfectly accurate in virtual mode and/or could require a seek table to be added in the source to be able to work as a virtual voice using the Play from elapsed time option for its return to physical voice. 出于这个原因,并为确保默认情况下所有声音均正常运行,因此未将其作为默认设置。例如,将 Vorbis 设置为 Play from elapsed time 时,需要 Seek Table 才能采用正确的虚声部行为。


此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅