L4D2 Custom Particle Effects Tutorial: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
Line 9: Line 9:


For particles that appear in-game, there is no distinction between PCF files stored externally or in a VPK as long as the PCF file is registered in a manifest. '''The manifest, on the other hand, requires particles\particles_manifest.txt to be read via an add-on VPK or simply with a per-map manifest (maps\<map name>_particles.txt) without the need for a VPK.'''
For particles that appear in-game, there is no distinction between PCF files stored externally or in a VPK as long as the PCF file is registered in a manifest. '''The manifest, on the other hand, requires particles\particles_manifest.txt to be read via an add-on VPK or simply with a per-map manifest (maps\<map name>_particles.txt) without the need for a VPK.'''
{{note|As long as particles_manifest.txt is included in a [[L4D2_Campaign_Add-on_Tutorial#Mission_File|campaign add-on]] (in other words, "not a content pack", determined by including a mission text file), there should be no conflict with the official manifest.}}
{{note|As long as particles_manifest.txt is included in a [[L4D2_Campaign_Add-on_Tutorial#Mission_File|campaign add-on]] (in other words, "not a content pack", determined by including a mission text file), there should be no conflict with other campaigns that rely on particles_manifest.txt.}}


==Setup==
==Setup==

Revision as of 15:06, 21 October 2011

Left 4 Dead 2 Since the March 11, 2011 update, Left 4 Dead 2 fully supports custom particle effects. This tutorial only covers workflow on particle effect authoring that is unique to Left 4 Dead 2 (and possibly similar to future Valve games). Information on the actual creation of particle effects can be found at the Particle System category. While there may appear to be many steps in this tutorial, all of them are very small and easy to follow. Authors are encouraged to create their own workflow suitable to their unique needs.

Todo: pictures, cleaning up, complete info, testing

Overview

Particle systems are stored in PCF files, where one PCF file typically contains a library of 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 (for precaching) in-game. In L4D2, authors of custom particles can choose between two types of manifests:

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

Official particle files can only be read, edited, or shown by tools such as the Hammer Particle Browser and the Particle Editor provided that they are extracted from the VPK and placed in the particles directory externally. 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.

For particles that appear in-game, there is no distinction between PCF files stored externally or in a VPK as long as the PCF file is registered in a manifest. The manifest, on the other hand, requires particles\particles_manifest.txt to be read via an add-on VPK or simply with a per-map manifest (maps\<map name>_particles.txt) without the need for a VPK.

Note.pngNote:As long as particles_manifest.txt is included in a campaign add-on (in other words, "not a content pack", determined by including a mission text file), there should be no conflict with other campaigns that rely on particles_manifest.txt.

Setup

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. Alongside the Particle Editor are the Hammer Particle Browser and vpk.exe.

Todo: setup of workflow, such as: particle browser talk, add-on creation, pcf creation, introduction of particle in a map in hammer, in-game testing and, yes, pictures

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.

Todo: What takes precedent, the external PCF or the PCF files found in the official VPK?

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 more details on how to create a 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.

As for introducing the new PCF file in-game, the existing updated particles_manifest.txt must be introduced as a simple VPK in the addons folder. At the very least, the VPK only needs to contain the updated particles\particles_manifest.txt. The other option is to add maps\<map name>_particles.txt without any need to pack into a VPK. 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 in-game / Particle Editor

While the manifest file provides the available particle systems, the particle systems that are used in a map still need to precached. They are usually precached by adding 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.

All of these steps ultimately leads back to 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. It is highly recommended to test out the complete add-on free of any custom assets stored externally. Testing can done with a separate computer or a clean installation of the game.

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 a reliable custom particle (like a very basic one) can even show up in-game. Hunt down anything that may be inconsistent in comparison to official particles or this tutorial.
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.
Todo: include other issues encountered. Answer them, if possible.

See also

External links