L4D Soundscripts

From Valve Developer Community
Revision as of 20:29, 19 July 2009 by ThaiGrocer (talk | contribs) (Saving, again.)
Jump to navigation Jump to search

Introduction

Left 4 Dead (L4D) soundscripts are located within the path /left4dead/scripts. They are plain text files (.txt extension) used to invoke in-game sounds such as weapons, soundscapes, and music during events output by the sound emitter. The script game_sounds_manifest.txt will preload or precache the soundscripts when Left 4 Dead is loaded. The base path for all sound files is /rootDir/sounds/. This means that all of the soundscripts will look in /rootDir/sounds/<soundscript entry> for sound assets, where rootDir is pointed to a VPK addon or /left4dead/.

Custom L4D Soundscripts

Note.pngNote:There is a proper way to create custom L4D soundscripts. Packing and shipping edited soundscripts found in the scripts folder, including the manifest itself, to end users would conflict with VPK addons following the same incorrect method. More importantly, they will completely replace soundscripts for the original Valve campaigns.

Many L4D soundscripts, especially the one for music, depend the content of three things: the mission text file, the actual soundscript, and the navigation mesh.

  1. The missions/<mission name>.txt file registers a unique name, an entry called "NAME", that are important for L4D soundscripts such as the music soundscript. The mission file also lists all of the actual map files that are part of the mission. Many entries in the music soundscript depends on the "NAME" entry found in the mission file, where "NAME" is used by the Sound Emitter with the maps registered under it.
  2. As with any source game, a soundscript found as maps/<mapname>_level_sounds.txt can override official soundscript entries without affecting other campaigns. Official Valve campaigns may use sound_games_music.txt for music soundscript entries.
  3. The nav mesh must be properly marked with attributes to invoke certain events

No Mercy Campaign (Example)

The following details will use a music soundscript entry in No Mercy (an official Valve campaign) as an example.

  • Mission File
    • The No Mercy mission text file is found as maps/hospital.txt.
    • "NAME" entry is uniquely labeled as "Hospital"
    • hospital.txt contains a list of the exact names of the maps: "l4d_hospital01_apartment" ... "l4d_hospital05_rooftop".
  • Sound Script and Nav Mesh
    • Event.MissionStart_Hospital is an entry in the soundscript sound_games_music.txt
    • In the initial spawning point of the No Mercy campaign, the Sound Emitter invokes an event called Event.MissionStart_Hospital
    • The event is only invoked in the map files listed in the mission file if the navigation mesh is labeled with the attribute CHECKPOINT and the mission has just started.

When Entries Occur

Some occurences of entries found in soundscripts are easier to predict than others. For example, Player.PickupWeapon occurs during moments when the map initially loads and when a player picks an item or a weapon. Some entries occur in L4D only when the nav mesh is properly labeled at a specific part of the map. Some entries even depend on the atmosphere, such as a room fully clear of common infected.

There are ways to see how some certain entries occur. One way is to look at comments found in the soundscripts provided by Valve. Another way is to see what entries are being invoked in-game. This can be done by temporarily moving the soundscripts to another directory (or deleting the entries in all the soundscripts temporarily) and running the game in developer mode in order to see when the Sound Emitter invokes a sound to play, but cannot find a sound entry in the soundscripts loaded. An example would be Sound Emitter warning about the missing sound file for Event.MissionStart_"NAME" if an entry has not been created yet. One may have to investigate the navigation mesh, consider the situation and documentation, the change in visibility of the map, etc.

The following entries list

Soundscripts Manifest

The L4D soundscripts manifest, game_sounds_manifest.txt, is a list of soundscripts that are either preloaded or precached when the game is loaded. The following is the actual manifest for L4D. The soundscripts are separated in this manner mostly for the sake of organization. All of the scripts, in this case, could have been combined into two soundscript files for either precaching or preloading:

game_sounds_manifest
{
	 "precache_file"  	"scripts/game_sounds_bots.txt"
	 "precache_file"  	"scripts/game_sounds_terror.txt"

	 "precache_file"  	"scripts/game_sounds_infected_common.txt"
	 "precache_file"  	"scripts/game_sounds_infected_special.txt"

	 "precache_file"  	"scripts/game_sounds_player.txt"
	 "precache_file"  	"scripts/game_sounds_biker.txt"
	 "precache_file"  	"scripts/game_sounds_manager.txt"
	 "precache_file"  	"scripts/game_sounds_namvet.txt"
	 "precache_file"  	"scripts/game_sounds_teengirl.txt"
	 "precache_file"  	"scripts/game_sounds_npcs.txt"
	 "precache_file"  	"scripts/game_sounds_npc2.txt"


	 "precache_file"  	"scripts/game_sounds_music.txt"
	 "precache_file"  	"scripts/game_sounds_doors.txt"

	 "preload_file"  	"scripts/game_sounds.txt"
	 "preload_file"  	"scripts/game_sounds_physics.txt"
	 "preload_file"  	"scripts/game_sounds_weapons.txt"
	 "preload_file"		"scripts/game_sounds_ambient_generic.txt"
	 "preload_file"		"scripts/game_sounds_world.txt"

	 // Level sounds

	 "preload_file"		"scripts/level_sounds_general.txt"
}

List of L4D Soundscripts