Hi again all,
This is another one of my reference posts. Unlike previous posts, which have focused mainly on code, in this one I'm going to turn my attention to Particle Effects. Specifically, I want to share how to create very basic effects that can serve as placeholders or starting blocks for your skills, traps, and events. I really stumbled through some of these basics steps and now keep notes on my desk on how to do each one of them quickly, because I run into the need to use them in so many situations. Note that, because I'm more of a code guy, these effects tend toward the “practical” side more than the “pretty”–I'll let someone else explain how to make these beautiful. :)
(Note that if this is all TLDR, there is a recipe for each particle effect description at the end of each post.)
It's also a pretty long process to explain these so I will not try to do all of them at once. :)
Before reading this, I highly recommend reading the basic Particle Effect tutorials on Runic's Wiki for reference on basic settings and how to load, save, etc a Particle Effect in the editor. The Runic files do a reasonable job of explaining the basics; what I am going to focus on specifically is understanding how those settings translate into actual, useable effects that can be used by skill, area, and monster coders who need to be able to represent the effect quickly in game.
”But I'm not really an artist!“ you say. That's okay, neither am I. :) I have had to learn Particle Effects through a brute-force effort. The intent of this post, rather than turning you into a Particle Effects genius (which I'm surely not), is to explain how the most basic particle effects function. The hardest part of understanding Particle Effects, IMO, is understanding that most of the time most of the settings don't apply. For that reason, I'm not going to focus on settings that are unchanged from their defaults.
The 6 Basic Kinds of Particle Effects I hope to get around to covering include:
The Village Billboard
The “Village Billboard” is the term I use to describe the extremely basic floating icons you see in-game floating above the heads of merchants. Here's an example on the Blacksmith character in the first town:
You may have wondered how the game puts these icons on a merchant. It turns out these basic icons use the exact same system as spells that follow or attach to the player, using a concept called UnitThemes. This post isn't entirely about Unit Themes, so I'll gloss over the highlights: Basically a Unit Theme is a file that attaches 1 or more Particle Effects to a Unit. The Particle Effect is created as an individual file, then a reference is added inside a Unit Theme (created in the Unit Themes editor). In the case of merchants, that Unit Theme is assigned to the Unit (the merchant) within the Units editor. (A Unit Theme that attaches via a skill could also be assigned using an Affix by using just typing the name of the Unit Theme in the “Unit Theme” field.)
Here's the Unit Theme used by the merchant icon. Any Unit we attach this to will get the little sack icon floating over his or her head.
The Particle Effect itself is located in \MEDIA\PARTICLES\QUEST (in the main TL2 folder structure). You can load it from the Particle Effects editor tab.
Here's what we see once we've got it open:
Okay, so we see there is just one Particle System at work here, containing a single emitter. It provides us with a very basic recipe we can use to create any sort of Village Billboard.
Starting with the Particle:
- RENDER TYPE is set to “Billboard.” This means we our effect will always be a flat object that faces directly at the camera.
- FRAMES HIGH and FRAMES WIDE are each set to 1. This is a very important setting. It defines the size of the source image. A setting of 1 and 1 means to use the entire source image. You will usually set this to 1 and 1 for any source image that does not contain a Texture Animation. Usually, with Runic-made source images, the High and Wide settings can be inferred from the name of the image–if the image contains two numbers after it, change High and Wide to match. If it doesn't, usually you should set both to 1 and 1. 50% of problems I see with beginner particle effects comes from not correctly setting this value.
- RENDER STYLE - Alpha. A setting of “Alpha” means that the source image is render in solid color with an Alpha channel defining the areas of the image not to draw. If that makes no sense to you, consider this: are you familiar with the term RGB (red blue green) that defines the colors on your monitor, and how each pixel in an RGB image has a separate “channel” defining its value (one for red, one for blue, etc)? Well, an Alpha channel is exactly the same except it defines which areas of the image to draw. A pixel with a setting of 255 is completely solid, while one with a setting of zero doesn't get rendered. Anything in between is translucent. The “bag” image has an alpha channel that cuts out the shape of the bag (defined in the image with a tool like Photoshop), which is why it renders fully opaque with cutout edges instead of as a picture of a bag with a big square around it.
- TEXTURE - The path to the source image to use. You can find all kinds of textures in MEDIA\PARTICLES\TEXTURES. Changing this reference will change the appearance of your billboard. Pretty neat huh?
- LIFE TIME - 0 . Very important. This defines how long the particle sticks around. We want this one to never expire. A setting of 0 means “forever.” If we set this to say, 2, the icon would only display for 2 seconds on our merchant and the vanish. Note that LIFE TIME, which is set at the Particle level, differs from PARTICLELIFE at the Emitter level. LIFE TIME is the time for [i]the whole system[/i] and PARTICLELIFE is [i]per particle.[/i]
On to the Emitter. Like the Runic tutorials explain, the Emitter defines [i]how[/i] the source image is used as opposed to the fact [i]that[/i] it is used. Basically you can think of the Particle object as a “loader” and the Emitter as the “user.” Particles with no Emitters never display on screen. (A particle can also have more than 1 emitter, but we're not focused on that now.)
The key to emitters is that most of the screen you can ignore. The only settings we ever care about are the ones related to the type of Emitter we have, along with the DIMENSIONS, EMISSION, MOVEMENT, PROPERTIES and POSITION fields. As you'll after a few of these particle effects are explained, we're usually only looking at a very small subset of each of these and leaving most of them at their defaults.
In this case, the TYPE OF EMITTER is a Point. This means anything rendered will appear on top of this point.
VELOCITY - This is set to zero. By default, when you create a new particle, it is set to 15, which sends particles flying off screen. We don't want that. By making it zero, it stays in place.
NUM LOOPS - 1 The emitter will only create particles one time.
KEEP LOCAL - True. This means that the particle will move when the unit theme moves.
NO EXPIRATION - True. This means the particle never expires. This is very important. It's what makes the emitter ignore the PARTICLELIFE setting. Our billboard should stick around forever, and it will, as long as this is set.
EMITRATE - 1 . This means how many source images to render. Obviously, we just want 1. What would happen if we set to this to some other number, say 15? The answer is we'd get 15 images layered on top of each other. We likely wouldn't be able to tell though, with the way this particle effect is set up. The main concern would just be wasted resources. So we can just set this to 1 and call it a day.
EMITDURATION - 0. This means how long each loop of the particle is. (Remember in this case we only have one loop.) We want ours to show up right away, so we just set this to 0.
In review, to set up a Village Billboard, the settings we look to are:
RENDER TYPE - "Billboard." FRAMES HIGH and FRAMES WIDE - 1 (usually) RENDER STYLE - Alpha (usually) TEXTURE - Whatever we want it to look like LIFE TIME - 0 QUALITY - LOW
TYPE OF EMITTER - Point VELOCITY - 0 NUM LOOPS - 1 KEEP LOCAL - True NO EXPIRATION - True EMITRATE - 1 EMITDURATION - 0