My program doesn't have bugs. It just develops random features.
Legacy:On ParticleGenerators (U2)
SCOTT DALTON'S Basic Particle Generator Tutorial
While I haven't had time to write up a full tutorial for particles, I thought I'd take a moment to describe some of the basics of particle generators in Unreal 2. Particle Salamanders and Particle Radiators are powerful tools and can be used for a variety of effects and functions within the game. We've only scratched the surface of the possibilities with the effects in Unreal 2.
The particle setup within UnrealEd is all controlled through editing properties. We chose to put our time into functionality rather than making it pretty, so there is very little idiot proofing in the system. What this means is when you're first learning your way around - save often when working with particles. Certain actions you may take may not be compatible, so things may crash if you do something "bad".
You'll quickly learn what can be used with what, and I'll give a brief list of what can and can't be used. The system has been in place for a number of years and there are a few legacy components in there which no longer are terribly useful.
Okay, so now that I've got that disclaimer out of the way, on to making cool stuff. Once you've learned a few of the basics, you can edit existing systems to get the effects you want or whip up your own effects from scratch.
First a few basics :
- Particle Salamanders
- these generators emit in a cone that can be specified up to a full sphere (360 degrees).
- Particle Radiators
- these generators emit from the surface of a Golem mesh. They can emit randomly, linearly, or from a certain index of triangles on the mesh and can come out from the center of the triangle or a random position on the triangle.
The Unreal 2 particle system works by combining Templates (basic particle types) with Forces (things that control what the particles do). You can have any number of templates within a single system, and any number of forces affecting those templates. This allows you to stack as many parts to a system as you need within a single generator.
- templates are a basic particle type. The most common are rotating particles (a sprite with a controllable rotation), textured streaks (a ribbon type of particle with a texture applied along its length), View Velocity Particles (a single quad particle that stretches depending on its velocity relative to the players view), and particle decals (a flat plane particle, often used for decals where it derives its name). There are many other types of particles, but these are the basic types used for many effects.
- forces control what a particle does. Forces can be just about anything from a resize force, to gravity, friction, collision, damage, color, rotation, fade, etc. Many forces have a "phase." The phase determines how many times it moves back and forth within a particles lifespan. For example you can resize a particle to make it grow. With a phase of one it will always grow. With a phase of two it will grow until half of its life is over then begin to shrink at the same rate. A phase of three will make it grow, then shrink, then grow again, etc. Multiple forces of the same type can be applied to a template to achieve interesting effects, especially when combined with each using different phases.
- almost every variable within the particle system allows for a range. This means that when determining how something will behave, it will randomly choose a number in the range between what you supply it with. For example a particle can have a lifespan range of 1 and 5 seconds. Any variable that allows for ranges will have an A and B component. There is no Max and Min, it is simply a number between the two values, so it makes no difference which is which.
Okay - now jumping into our first particle. Go to UnrealEd and call up a level or COD (Cube Of Death - empty cube). Right click in the world and select the "add particlesalamander" option. You'll see the icon for the ParticleSalamander appear. Right click on it and bring up its properties.
First go to ParticleSalamander tab. You'll note the Spread defaults to zero. This means that particles will fire out in a straight line from the direction the arrow is pointing. Lets make them shoot at a 30 degree arc, so change that number to 30. Now we don't have any particles yet, but you'll also notice a volume here. Volume is the number of particles spawned per second. Let's set that to 25 to start.
Now click on the ParticleGenerator Tab. You'll notice that there are forces and particletemplates. Click on the '...' to the right of ParticleTemplates. A dropdown box will appear, underwhich you can select a template type. Open the dropdown and select Rotating Particle Template. This will add a rotating particle template to your template list. Click to the left of the Rotating Particle template box. You'll see three boxes pop up Edit, Duplicate, and Delete. These may cover up the in-line editing + box, in which can you can simply slide the divider bar to the right. Now either click on the Edit button (which will bring up a seperate window) or click on the + box (which will in-line the properties into the same window.
You'll see a variety of possibilties here, but first things first, we want to supply it with a texture so we can see the sprite. Open up the texture browser, select the SpecialFX package, and go to the Glows group. Here, select flare_01.
Now open the Rotating Particle Template tab for the template you just added. Click on the field for sprite and hit "Use" to set your previously selected texture onto your template.
Now click on the Rotating Particles tab and you'll see a range for the Initial Rotation. We'll want our flare to be able to start at any rotation, so we'll set A to 0 and B to 360. Now if you go to your 3D window and enable realtime mode (click on the joystick or hit P), you'll see the beginnings of our system - a glowing orb.
Particles are blinking on and off rather jarringly so far, so let's make them fade in and out. For this example let's have them rapidly fade in and slowly fade away. For this, we'll need to add some forces to our system. Click on the rotating particles name (RotatingParticleTemplate'MyLevel.ParticleSalamander0.RotatingParticleTemplate0'). You'll see a list a dropdown box appear - this allows you to add a force to this particular particle template. Drop down the box and select FadeInForce.
You'll see a window pop up. Click on the FadeInForce tab. By default, the range is set to one second. Change the range to be between .1 and .2 seconds. Close the window and go back to your 3D view in realtime. You'll see the flares are now fading in, but still blinking out. We want them to slowly fade out, so go click on the template again and this time add a fadeout force.
Let's set the range on the Fadeout Force to be between .4 and .7. Now close the window and you'll see our orb taking on more of a gentle pulsing in appearance. However, it doesn't really have quite the right look yet. Let's make it appear to be pulsing outward by having each particle start small and grow. So let's return to the templates properties and find the SpriteParticleTemplate -> Initial Size range. Let's set that to .1 and .2.
Now we'll add a resize force to make it grow. Repeat the force adding steps above, but select a resize force. Set the range to be .6 and .75 and return to the 3d view. Ah, much better outwards pulsation.
Now let's give them a bit of rotation, so go and add a RotationForce to the template (Note : unfortunately Rotation force -only- works on rotating particles. Trying to add it to other template types may cause problems). Let's go for a subtle rotation here, so set the range to 50 and -50 to make them move between 50 degrees clockwise and 50 degrees counter clockwise over a second.
Now would be a good time to save.
Okay, so we've got a basic effect going, now let's spiff it up a bit with some textured streaks. Click to the right of the ParticleTemplates tab again and bring up the drop-down box. Select the TexturedStreak template type. You'll see it appear below your rotating particle template in the list.
Open up its properties. Textured streaks come with a default texture assigned, so for now we'll leave that. Let's instead go to its ParticleTemplate Tab (This tab is under all particle types, so what you use here can be applied elsewhere). Let's open up the InitialSpeed range and set it between 100 and 400.
Looking back at our 3D window, you'll see streaks shooting out of the system, in a 30 degree cone. Let's up the cone to 360 so we can see the streaks fly out in every direction. Better, but we can do some more to make it interesting. Let's give this textured streak some gravity. For this we can use a variety of forces such as a global accelerator (which allows for X, Y or Z acceleration) or perhaps a per-particle gravity force (which allows a range of per-particle gravity). Let's use a PerParticleGravity here. Select the TexturedStreak name to open its force drop-down box and select the PerParticleGravity Force. Let's set the range to be 700-1200 for now. Now let's give it some collision, but first we should save.
Add a GeometryCollider force to your textured streak. If your particle salamander is near a wall or floor, you'll see the streaks begin to bounce around. Geometry colliders have a lot of fun properties you can play with. You can give them a range of bounciness (Elasticity), make them stop on contact, make the bounce angle random (bDiffuse), delete the particles on contact, make the particles play a sound when they hit, make them spawn new particle templates (Impact Effects), collide with actors, or only apply the above factors at certain angles (MinIncidence).
Let's make our streaks leave a little mark every time they hit a surface, so click to the right of ImpactEffects in the geometry collider. Note - if you try to do this from within the Inline editing properties, it will crash (this is a known bug with the inline code - sorry!). So be sure to be working in a seperate window when you add this new template (do this by clicking on the force's edit button rather than the inline + box). Let's select a ParticleDecal from the list of templates so we can leave a decal behind.
Okay, for our little decals, lets select the lensflare7a1_tw128 in the glows catagory of the SpecialFX texture package. Like most particle templates, the texture goes under the SpriteParticleTemplate tab of the ParticleDecalTemplate. They're going to be a bit big to start, so let'set their size. Decals are in absolute world size, so lets make ours 3 to 4 units in size.
We want them to last longer than their default 1 second, so lets go to the ParticleTemplate section and set their InitialLifeSpan to 10-15 seconds. To make them fade out, repeat the fadeout force adding steps above, but give it a much higher time, say 9 or 10 seconds. Let's also make them grow slightly as they fade out so also give the decals a resize force of about 1.
Now our streaks are leaving little blue puddles of color behind that melt away. Let's save it before we continue. How about we make it a bit more dangerous? Let's add a particle damage force to the textured streak. We can leave it weak for now. Under the particle damage force you'll notice momentum settings. These can be used to knock around damaged characters. Note that Unreal's momentum settings tend to have to be quite high, so you'll usually have to set a number in the thousands to achieve the effect you want. You'll also notice a damagetype setting. This is used for all the various kinds of damage in the game. Let's make these guys light people on fire when they hit them - so set the damage type to be Thermal.
You may notice that the streaks some times make it outside the world and fall away, leaving decals as they go. Some times due to the physics, a particle can make it through a wall completely before it registers that it has hit the surface. In this case we simply wish to remove the particle from existance. To do this, add a VoidDestroyer force to the textured streak. This simply prevents any unnecessary overhead.
Okay, so now let's test the fruits of our labor. Save the map and fire it up. You'll see that as you touch the streaks in game they cause you to take damage as well as light on fire. You'll notice that the particles don't bounce off of you or get destroyed when they hit you. These are options you can of course change (for actor collision set bCollideActors under the GeometryCollider force, for having the particles be destroyed when they hit someone, which is good for bullets and such, set bDeleteOnContact to true under ParticleDamage's ActorCollisionNotifier tab)...
To edit any of the existing forces on a template, you can find the forces under the ParticleTemplate -> Affecting Forces array. You can also find them under the forces list, which lists all forces for all templates, but for complex systems this can get to be a big list of forces to find the one you need in.
I've only scratched the surface of what is possible with particles here, but this should at least give you an eye into how they work. I hope to have time to do a full blown tutorial and reference of particle types, forces, and variables that can be used.
As another note - you can also globally apply forces to all current templates by adding them under the forces tab (much like you'd add a new template type). This will add the force to all current templates, but no templates added after the force was added. You can apply any existing force to all existing templates by going to the Forces Force tab and setting bIterateAll to true. Generally, the best procedure is to add forces to individual templates as you need to. This allows you the most control over the particles themselves and generally is not a performance cost.
When deleting particles, you should clean up their forces by first deleting the forces from the forces array and then deleting the template itself. This prevents forces from hanging around which are no longer effecting any templates.
More to come. This first primer was just to take you through a few of the different template and force types with no real end purpose for the system. If people have requests for some particular sort of effect, post a suggestion and I'll see what I can do to demonstrate the effects and make sample maps available.
AARON LEIBY'S Quick Rundown of Particle Templates in Unreal2
- no longer works
- only used by bendibeams, don't add manually
- used by linemanager, don't add manually
- a sprite that's oriented to the hit normal rather than facing the screen (like what's left behind when you fire the shotgun), though there's other cool uses for this too – like the teleporter effect.
- simple d3d points (like what quake used)
- used with pulselinegenerator only, don't add manually
- I don't think this works any longer.
- a 3d sprite that can rotate (a bit slower than sprite3d)
- a 3d sprite (or billboard)
- a simple sprite (always the same screen size so it acts like a corona)
- for use with BarbieHareDesigner only : I don't think this works any more.
- line segments drawn between the last n positions of the particle (basically a point particle with history)
- used by tarpbuilder only : rudamentary cloth engine (I don't think this works any more)
- What the EnergyRifle primary fire bolts use – basically a textured version of the
- StreakParticleTemplate (thus its name)
- TriParticleTemplate / TriangleParticleTemplate
- only one of these works I think. It's what the plastic bits when you shot the assault rifle into certain surfaces used. It spawns triangular particles – actually sets of three particles that are held together by a TriForce (no really) – that way you get per particle collision on each corner if used with a GeometryCollider, etc.
- Useful for waterfalls or lock em for lights. A sprite that stretches based on its screen velocity. So if you look at a waterfall from the side the individual sprites can stretch out, but if you stand in it and look up, then they're nice and round (makes em feel real 3d if used correctly).
- sprite that rotates based on view angle – like coronas on streetlamps while driving in the rain.
Some forces can have their own subtemplates. Examples include GeometryColliders (that can spawn more particles - or maybe that's OnDestroyForces) and ParticleSalamanderForces (that can leave trails of particles behind). This is where your ghost templates come from. They usually have a SelectionWeight of 0.0 so they aren't selected by the normal process of generated particles. The Force will generally have a drop down box of particle templates that you can select from to add the sub templates.
Dangler: Since there is virtually nothing on this topic for Unreal2 Particle Generators which are a little different
than UT2k3 Emitters, I've posted what info I have obtained.
Particle Generators in Unreal2 were written by Aaron Leiby as far back as 2000, and are the precursor to UT2k3 Particle Emitters.
With the demise of Legend Entertainment, this may be all we get.
Tarquin: Do you have permission to include these in the Unreal Wiki?
Dangler: Yes, I asked Aaron, this was from a post he answered for me. Thanks for cleaning it up:) I didn't know how to add the bold text and whatnot.