L4D2 Custom Particle Effects Tutorial

From Valve Developer Community
Jump to: navigation, search

Left 4 Dead 2 As of March 11, 2011, Left 4 Dead 2 fully supports custom particle effects. This tutorial covers anything unique to L4D2 particle editing. For general particle editing, see Particle System category.

Overview

Particle systems are stored in PCF files, where one PCF file typically contains multiple particle systems that relate to each other (for example, blood_fx.pcf). All PCF files must be registered in a manifest file in order to be recognized in-game. In L4D2, you can choose between two types of manifests:

  • particles\particles_manifest.txt or
  • maps\<map name>_particles.txt (per-map)

Also consider the following:

  • Official particle (PCF) files can be extracted from pak01_dir VPK and placed in the particles directory externally (outside of the VPK).
  • The Particle Editor only reads PCF files stored externally. Hammer Particle Browser needs particles_manifest.txt in addition to PCF files to be stored externally.
  • In game, PCF files are read externally if none exist within the official VPK and must always be registered with the manifest.
  • particles\particles_manifest.txt needs to be packed and read via an add-on VPK or simply use a per-map manifest (maps\<map name>_particles.txt) without packing.
Note.pngNote:When you ship later on: As long as particles_manifest.txt is included in a campaign add-on (with a mission text file), it is not considered a "content pack". There should be no conflict with other campaigns that rely on particles_manifest.txt.

Setup

L4D2 Authoring Tools with Tools Mode highlighted.

The goal is to create a simple custom particle effect that will appear in-game and while in Tools Mode (located in the Left 4 Dead 2 Authoring Tools menu). Central to the entire process is the Particle Editor. The Particle Editor is an interface found in Tools Mode that acts as a unified work space for particle effect authoring. Along with the Particle Editor, the Hammer Particle Browser and vpk.exe will also be used.

Particle preview in Hammer

This part is optional but highly recommended if you want to see particles in Hammer. Please see Particle Browser for details on how to extract existing particle files for preview.

Create a simple particle

Since the Particle Editor does not rely on any manifest, a new PCF file along with new particles can be created first. A good particle to start with is a particle that is known to appear in-game without any issues.

Please see the Particle System Overview for details on how to create a new particle that spews out white sprites radially from a single point.

If you do not want to create a particle from scratch, feel free to also try a modification of an official particle. Remember to save the PCF file with a different name. The PCF files is saved in the root of the particles folder by default.

Create the manifest

For the Particle Browser, edit the external particles\particles_manifest.txt in order to register the new PCF file name. Simply follow the entries as an example. Finally, make sure the text file is saved before refreshing the Particle Browser in Hammer.

To see the new particle in-game, create particles_manifest.txt as a simple VPK in the addons folder or create a per-map particle manifest maps\<map name>_particles.txt. Please see the L4D2 Campaign Add-on Tutorial for details on VPK authoring.

Note.pngNote:There is no need to for the manifest to contain all of the entries from the official manifest and only new entries will suffice.

Add the particle to a map

This Particle Editor is from Alien Swarm. The L4D2 version looks slightly different, but work in the same way.

Add an info_particle_system entity in a map, where the entity is pointing at a specific particle system. The entity properties window also conveniently provides access to the Particle Browser under the keyvalue Particle System Name.

In this case, choose a reliable test custom particle system, allow the entity to start active, and compile the map. The particle should show up in-game.

Now you're ready to work on your particle within the Particle Editor! Set cvar sv_lan 1 and load the test map containing the custom particle system. Any changes to the custom particle should update within the map loaded. This allows authors to iterate on custom particles in a very efficient manner. Please see the troubleshooting section if there are any difficulties with the in-game preview.

Shipping the particle

When ready to ship the particle in a campaign add-on, simply pack the custom PCF file along with either the modified particles_manifest.txt or per-map manifest in their proper directories. Please see the L4D2 Campaign Add-on Tutorial for more details. See how the VPK holds up by itself, free of any externally stored assets. Congratulations on shipping!

Troubleshooting

Particle Browser

  • Official particles or custom particles do not show up as a choice in the Particle Browser.
  • The preview window for a particular particle system does not appear to show any activity.

Particle Editor

  • It is difficult to dismiss the Map Unplayable! error while in tools mode.
One quick way is to use the command cl_drawhud 0. Please see Common L4D Mapping Problems for more details on the issue.
  • Particle effect fails to update in the map.
If a particle effect fails to update in-game despite there being a change in one of the components or properties, a series of console commands can reset the info_particle_system entities that exist in the world: ent_fire info_particle_system stop;wait 120;ent_fire info_particle_system start

In-game

  • Particle fails to show up in-game.
There is more than one reason why it may not show up. Usually this is solved by eliminating a cause one by one. For instance, check if the particle needs to be started manually. Also see if a reliable custom particle, can even show up in-game.
Note.pngNote:If there are additional questions regarding setting up working custom particles in L4D2, please leave them in the discussion section of this article.

See also

External links