Ru/Soundscape: Difference between revisions

From Valve Developer Community
< Ru
Jump to navigation Jump to search
Line 32: Line 32:
*[[env_soundscape_triggerable]]
*[[env_soundscape_triggerable]]
Есть другие энтити, которые активируют саундскейпы, но только эти две фактически определяют свойства звукового оформления. Другие энтити могут указывать на них и включать удаленно.
Есть другие энтити, которые активируют саундскейпы, но только эти две фактически определяют свойства звукового оформления. Другие энтити могут указывать на них и включать удаленно.
Всякий раз, когда энтити активируют саундскейп, воспроизводится позиционный звук в соответствии с заданными свойствами. {{tip:ru| Многие саундскейпы задают позиционные звуки (исходящие из определенной точки), так что неплохо заглядывать в записи саундскейпов, чтобы получить представление о том, что и как можно сделать. Большинство записей находятся в текстовых файлах, список которых в файле <code><game>/scripts/soundscapes_manifest.txt</code>. Чтобы лучше понимать записи саундскейпов, [[Soundscape:ru|см. сюда]].}}
Всякий раз, когда энтити активируют саундскейп, воспроизводится позиционный звук в соответствии с заданными свойствами. {{tip:ru| Многие саундскейпы задают позиционные звуки (исходящие из определенной точки), так что неплохо заглядывать в записи саундскейпов, чтобы получить представление о том, что и как можно сделать. Большинство записей находятся в текстовых файлах, список которых в файле <code><game>/scripts/soundscapes_manifest.txt</code>. Чтобы лучше понимать записи саундскейпов, [[Soundscape#Creating_Soundscapes|см. сюда]].}}


== Activating Soundscapes ==
== Activating Soundscapes ==

Revision as of 23:09, 31 July 2015

Template:Otherlang2

Саундскейп - это тип звукового сценария, который добавляет в карту атмосферу. Может использоваться на любом количестве карт, требуется только одна энтитя и не генерируется сетевой трафик. Саундскейпы используют смесь из зацикленных и произвольно воспроизводимых звуков, каждый из которых может быть присвоен одному из восьми целевых мест; также задействуется профиль DSP.

Одновременно может работать только один саундскейп, а его отдельные звуки не могут управляться с помощью входов. Когда игрок активирует следующий саундскейп, игра создает плавный переход между звуками от одного к другому.

Template:Tip:ru

Template:Tip:ru

Template:Note:ru


Просмотр саундскейпов

Как правило, саундскейпы находятся в папке игры game abbreviation\scripts\, и хранятся в нескольких текстовых файлах с именами soundscapes_map name.txt. (Они запакованы в оригинальные игры Valve, но автоматически переназначаются и распаковываются в папку, где запускается карта.)

В свою очередь, все они перечислены в файле game abbreviation\scripts\soundscapes_manifest.txt.

В нижней части этой статьи вы найдете ссылки на саундскейпы отдельных игр, наряду с попытками их описания.

Все имеющиеся саундскейпы вы можете прослушать непосредственно в игре, используя консольную команду PlaySoundscape. После ввода символов команды, выпадет список саундскейпов, который можyj прокручивать стрелочками.

Конфигурирование саундскейпов

Саундскейпы могут кофигурировать только эти энтити:

Есть другие энтити, которые активируют саундскейпы, но только эти две фактически определяют свойства звукового оформления. Другие энтити могут указывать на них и включать удаленно. Всякий раз, когда энтити активируют саундскейп, воспроизводится позиционный звук в соответствии с заданными свойствами. Template:Tip:ru

Activating Soundscapes

Any soundscape entity that is enabled and becomes triggered by the player, activates its - or its master's - specified soundscape. Soundscapes remain active until a map change occurs, or another soundscape is activated, even if the entity that originally activated it becomes disabled.

Tip.pngСовет:The soundscape_flush console command will cancel an active soundscape.


Soundscape entities

Soundscapes can be activated by any of the following entities:

Soundscape entities are themselves point-based, but trigger when the player enters their specified radius and the entity has a line of sight to him.

The two exceptions to this are env_soundscape_proxy (that is triggered through an env_soundscape or an env_soundscape_triggerable), and env_soundscape_triggerable (that is typically set to also be triggered by a trigger_soundscape).

As only one soundscape can be active at any one time, if one or more soundscape entities are triggered simultaneously, the closest one is given precedence. (The radius of soundscape entities always take precedence over trigger_soundscape brushes.)

Note that a soundscape will not stop playing just because a player exits its radius or it loses line of sight to him.


Tip.pngСовет:Use the convar soundscape_debug to examine which entity is active and why.


Soundscape Placement

At first, a good rule is to place only as many soundscapes as you absolutely need. Try to choose from a similar set of soundscapes to be played, and then pick one that will be your primary soundscape. After that, place your secondary soundscapes at every contrasting location (e.g. house, generator room). Make sure that every location with localized sound effects has its own master soundscape that is tied to the proper targets.

Once you've gotten a general idea of where your soundscapes will be located, you'll then be able to start adding/configuring the entities that will trigger your soundscapes and create a kind of blueprint for how soundscapes will flow from one to another. In many cases, you'll be placing entities that block off all exits from your contrasting locations with triggers to your primary soundscapes. Basically, the goal is to anticipate the player's movement throughout the map, and to block off each area in such a way that it will always have the proper soundscape activated.

After your flow is organized, you'll be able to specialize your soundscapes/triggers to behave in complex ways (e.g responding to game events).


Custom Soundscapes

Creation

Soundscape scripts are very similar to soundscripts, but still remain entirely different things.

Soundscapes require a few of their own rules, and are placed in plain text files that are separate from normal soundscript files. A typical soundscape file might be named soundscape_mall.txt and may contain anywhere from 5-30 different soundscapes that take on the following format...

<name>
{
	<rule>
	{
		<keyvalue>
		...
	}

	...
}

Common keyvalues

wave <string>
The path and filename of the sound to play, relative to game\sound\.
volume <normal>
1 is full power, 0 is silent.
pitch <integer>
Percentage value. +/-30 is the useful range.
position <0-7>
One of eight locations in the world (defined by the mapper) from which a sound can be emitted.
position random
As above, but the sound emits from a completely random location near the player.
attenuation <float>
How quickly the sound's volume drops as the camera moves away from it. Only relevant with a position specified.
Нужно сделать: What are the rules?
soundlevel <string>
Can be used instead of attenuation. Accepts one of the engine's pre-set values.
Warning.pngПредупреждение:Remember to enclose any values with space characters in "quote marks".

Randomized values

Some rules accept 'upper' and 'lower' parameter values. For example:

"pitch"	"80,120"

Whenever the rule is executed the value will be randomly selected within the given range.

Rules

playlooping

Plays a sound constantly. Does not allow random values.

Note.pngПримечание:Sound files will not properly loop unless they have a cue point. See Looping a Sound.
"playlooping"
{
	"volume"	"0.98"
	"pitch"		"110"
	"soundlevel"	"SNDLVL_85dB"

	"position"	"0"

	"wave"	"ambient/swamps/water_Lap_loop_st.wav"
}

playrandom

Plays a sound after given number of seconds. Allows random values.

Playrandom requires all wave KVs to be inside rndwave (even if there is only one). A random selection will be made every time the rule is executed.

Warning.pngПредупреждение:Be careful not to specify any looping sounds in a playrandom group as they may not stop even if a different soundscape is activated.
"playrandom"
{
	"time"		"1,4"
	"volume"	"0.4,1"
	"pitch"		"90,105"
	"soundlevel"	"SNDLVL_85dB"

	"position"	"0"

	"rndwave"
	{
		"wave"	"ambient/wind/wind_med1.wav"
		"wave"	"ambient/wind/wind_hit1.wav"
	}
}

playsoundscape

Plays a complete soundscape. DSP presets in the 'sub-scape' are ignored.

name
Name of the soundscape to play.
position <int>
Offsets each position index of the sub-scape.
Нужно сделать: What does that mean?
positionoverride <int>
Forces all positioned sounds in the sub-scape to emit from one location.
ambientpositionoverride <int>
Forces all unpositioned (i.e. ambient) sounds in the sub-scape to emit from one location.
"SubScape"
{ 
	"playsoundscape"
	{ 
		"name"	"GenericIndoor"

		// Overall sub-scape volume to 50% 
		"volume"	"0.5"

		// Emit all positioned sounds from position 0
		"positionoverride"	"0"

		// Emit all ambient sounds from position 1
		"ambientpositionoverride"	"1"
	} 
}

dsp

Overrides the current DSP preset (which would otherwise be derived from the $surfaceprop of nearby materials).

For a list of values, open scripts\dsp_presets.txt. You may need to extract this from the relevant engine GCF with GCFScape. To preview a DSP preset, submit room_type <int> to the console.

Note.pngПримечание:Be careful when setting presets in soundscapes that could be used in many different locations.
Note.pngПримечание:You can also use dsp_volume to define how loud the dsp effect is.
// Disable DSP and play no ambient sounds 
"Empty"
{ 
	"dsp"	"0"
	"dsp_volume"	"1"
}

soundmixer

Selects a custom soundmixer. Soundmixers manage the priority and volume of groups of sounds; create new ones in scripts\soundmixers.txt (ALWAYS use Default_Mix as a template).

"quiet"
{
	"soundmixer"	"Citadel_Dialog_Only"

	...
}

Example

"swamp.water.slow"
{
	"dsp" "1"

	"playlooping"
	{
		"volume"	"0.98"
		"pitch"		"110"
		"soundlevel"	"SNDLVL_85dB"

		"position"	"0"

		"wave"	"ambient/swamps/water_Lap_loop_st.wav"
	}

	"playrandom"
	{
		"time"		"1,4"
		"volume"	"0.4,1"
		"pitch"		"90,105"
		"soundlevel"	"SNDLVL_85dB"

		"position"	"1"

		"rndwave"
		{
			"wave"	"ambient/wind/wind_med1.wav"
			"wave"	"ambient/wind/wind_hit1.wav"
		}
	}
}

Looping MP3 Files E.G.

//////////// Outside bird sounds (loop mp3 sound file trick by gtamike_TSGK) ////////////
//////////// The 2 .mp3 files are the same as each other just not the same file name ////////////
//////////// MP3 Sound file runtime 3.29mins = 3 X 60 + 29 = 209secs ////////////

// mp3_loop

"mp3_loop"
{
	"dsp" "1"
	"playlooping"
	{
		"volume"	"1.0"
		"pitch"		"100"
		"soundlevel"	"SNDLVL_150dB"

		"wave"	"loop_mp3_soundscape/outside_1MB_20KB_part_1.mp3"
	}

	"playrandom"
	{
		"time"		"209"
		"volume"	"1.0"
		"pitch"		"100"	
		"soundlevel"	"SNDLVL_150dB"

		"rndwave"
		{
			"wave"	"loop_mp3_soundscape/outside_1MB_20KB_part_1.mp3"
			"wave"	"loop_mp3_soundscape/outside_1MB_20KB_part_2.mp3"
		}
	}
}
Warning.pngПредупреждение:Mp3 soundscapes might save filesize for custom maps but are not recommended. It can happen that the FIRST file at "rndwave" plays after the half of the time value has passed. In this case you have to double the value (418 in this case, but live with the consequence that the there will will be a pause after the soundfile has played twice.

Storing and using custom soundscapes

The engine uses the soundscapes_manifest.txt file to find all its soundscapes files.

It will look for this manifest (and typically the soundscapes as well) in the scripts\ folder on map start. Where this folder (and the root of custom soundscapes) is located, depends on whether the game is a modification (created through Create a Mod), or an original Valve game:

  • If it's a modification, the engine will look for it in the root folder of the mod.
  • If it's an original Valve game, the engine will instead look for it in the games game abbreviation\ folder. (For example, in the case of Half-Life 2: Episode 1 the engine will look for the manifest in the Steam\SteamApps\user\half-life 2 episode one\episodic\scripts\ folder.) In this case the scripts\ folder has to be created manually, and any custom soundscapes_manifest.txt found there, will override the original file.

To list a new soundscape in the manifest, simply add the line

"file" "location and file name"

within the curly brackets.

Typically the location and file name will be "scripts/soundscapes_custom map name.txt".

Note.pngПримечание:All soundscape names must be globally unique within a game.
Tip.pngСовет:If you want to add custom soundscapes to your map, and you haven't already, you should consider creating a full modification (through the Create a Mod option found in the Source SDK menu. This will prevent your custom manifest from overriding any soundscape updates made to the original game.


See also