Hello!
This will be a fairly basic introduction in to how to create and use custom particles in your Counter-Strike: Source (or other games for that matter) map. I will separate it into a few sections, and try to keep explanations both informative and to the point.
The reason I decided to create this, is due to the lack of tutorials on particles. If you would like a recorded guide, consider TopHATTwaffle's Guide.
- Requirements
- Creating Particles with the Source Particle Editor
- Including Particles in your Map
- Adding your Particle System to your BSP
Requirements
Not much is required for creating particles. All it requires, is access to the SDK of the game you plan to map for, and then any Source-based game. For this example, I will be using Counter-Strike: Source, naturally.
So for those who don't know, you can find "Hammer World Editor" at the following location: C:\Program Files (x86)\Steam\SteamApps\common\Counter-Strike Source\bin\hammer.exe
This will be used to implement the particles into our map.
The only other requirement, is to launch your source game in "tools" mode. This is fairly simple.
- Right-Click your Source game
- Click Properties (right at the bottom)
- Click "SET LAUNCH OPTIONS..."
- Type "-tools" and press OK
You should then be presented with a screen similar to the following:
You can play CS:S as per normal in this mode, however I do not recommend it.
Creating Particles with the Source Particle Editor
Ultimately, creating particles that look good all come down to trial and error. Here I will cover the basics, and from there you can go off, experiment, and find what looks nice.
So before anything, in tools mode, click "Tools" in the top bar, and change to Particle Editor. Not much will change, but this is required to create and modify particles.
Next, go File->New (or File->Open if you want to look how other particles are made). You will now be presented with 3 new 'sections'. I will now go over all four sections, in the order listed here:
- This is where all your particles in the current particle system are located.
- This is the test window. Using F10 and F11, you can play your source game here, and test particles.
- This is your properties window. Here is where you will edit your particles.
- This is the preview window. It will show you what your particle looks like.
So lets go ahead and create a new particle by clicking "Create" in window 1, and giving it a name. I will name mine 'test'. It may state that the particle already exists. If this is the case, don't worry. It seems to always say it.
If you were to click on the 'Properties' dropdown box, you will be greeted with a few options: Properties, Renderers, Operators, Initializers, Emitters, Children, Forces, and Constraints. More on these later. First we need to give our particle a nice texture.
So go ahead and click the "..." next to 'material' on the Properties tab, to be greeted with a window. Whatever texture you choose will be what your particle looks like. Note that particles are 2D, so they won't look like they do on the sphere. I'm going to use blood_core.vmt for this example.
As you will see, there is still nothing shown in the preview. This is expected, since we have nothing creating the particles yet. So lets go ahead and create a Renderer, obviously to render the particles.
Change the 'Properties' dropdown box to 'Renderers'. From here, you can right click in the 'functions' box, and click Add. I have chosen render_animated_sprites.
There are a bunch of parameters for this, but we are not going to worry about them. If you wish though, feel free to mess around with them to see what each of them does.
Next we need to add an emitter to actually create the particles. For this, I will be using emit_continuously, however the other two options can be used in many circumstances. Again, feel free to test them out.
So now we have your texture showing in the preview box! But still, nothing really happening. We will now add movement to them, so they are no longer static. So go into Operators -> Movement Basic. Here I am going to add a bit of gravity, 0 0 -10. Now the particles are falling. You will probably also realise though, that they stop falling once the counter at the bottom reaches 1,000.
So to solve this issue, we are going to add a lifetime to the particles, so they die after a bit of time. First, in Operators, create a Lifespan Decay. After this, Initializer -> Lifetime Random. I will make mine live between 3 and 5 seconds (lifetime_min and lifetime_max). If you are still following, your particles should be dying, and as a result constantly flowing out of the source.
But having all particles appear at the same place isn't too nice. So I will go ahead and add Initializer -> Position Within Sphere Random. From here, you can rezise the minimum area, maximum area, and even the location and speed of the particles when they spawn.
I have made mine spawn at 0 on the Z axis, and all around the circle located there.
If you were to ask me, I would say there are too many particles. If you would like to lower how many particles are spawning, simply go to your emitter and lower the emission_rate. I made mine 30.
So now how about we change the size a little bit, just because we can. In Initializers, create a Radius Random. Find a size that you think looks nice. Just remember, everything can be changed later on.
Just a reminder, if you haven't yet done so. Save your particle system, and give it a name you won't forget. I will use 'example'.
I went ahead and created an Alpha Fade in Random, and Alpha Fade out Random (located in the Operator tab) so the particles don't just appear and disappear instantly.
After a bit of messing around with other Operators, Initializers, and maybe even some other settings, you should have something that you like. Now just go back to Properties, and set 'max_particles' to a number just a bit higher than what your particles seem to cap at.Mine was around 130.
Now to quickly touch on the other options available.
- Children are other particles. This lets you include other particles you have created, if you say want to mix a few effects together.
- Forces, are as you expect, for pulling the particles somewhere.
- Constraints are to constrain the particle, such as preventing it from moving through walls or players.
So with that all done, it is time to test your particle properly!
Including Particles in your Map
This is fairly simple. Each particle is used with an info_particle_system entity. Here is a map I have put together that is simply a box with an info_particle_system in the centre that you can use.
http://puu.sh/5yFBA.vmf
Set the Particle System to whatever your Particle was called, not the whole System. In my case, my system was example, whereas my particle was called test.
Now if you have rushed ahead, you will notice that nothing is happening. No particles are showing. This is because the game doesn't yet know about them. We need to tell the game to load the particle system when the map is loaded.
Create a new text file, and put the following in it:
Code:
particles_manifest
{
"file" "particles/{your particle system}.pcf"
}
Where {your particle system} is replaced by your systems name, in my case "example".
Next save this to your maps folder as {map name}_particles.txt.
Now when you load up the map, you should see your particles! Easy as that.
Adding your Particle System to your BSP
Now for the final step. If the BSP doesn't contain your particle system, no one else will see them. For this, I will use PakRat. (there are probably better options)
Go ahead and select your map.
If you are familiar with PakRat, you will know that "Scan" usually adds all the files. In this case though, it will not find the particles.txt or the .pcf file. Simply manually choose these by clicking Add, and finding both files.
[u]For the .pcf file, you will need to choose "All Files" instead of "All Valid Pak Files".
Lastly, edit the path (by clicking on the file and pressing "Edit") and remove everything up to 'cstrike'. (Path to your pcf will just be particles, and path to your .txt file will be maps)
Then just save the BSP, and it should be all good to go!
Here is my finished product: http://puu.sh/5yGbH.bsp
And my .pcf: http://puu.sh/5yGep.pcf
Thanks for reading this (long) guide! As always, I will try to answer any questions anyone may have. If you wish to inspect how any other particles are made, you can extract them from a map with GFCScape, and then just open them with the Particle Editor.