Bzcommand.com
September 04, 2010, 04:38:47 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the Battlezone Command Community.
FishDotXSI Battlezone Complex Battlezone Realm  Bz2MD  Bzuniverse  BzScrap TimeDisruptor 
 
  Home   Forum   Help Search Groups Gallery Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Effect Tutorial 1 by TheJamsh  (Read 44 times)
GreenHeart
20th Century Mod
Rattler
**
Offline Offline

Posts: 77


20th Century Development


WWW
« on: July 03, 2010, 12:40:07 AM »

Rough Effects Tutorial by
By James 'TheJamsh' Baxter


The first thing you need to understand when making an effect is how a particle system (like BZ2's effect system) works. A particle system involves using colorised or grayscale textures (images) with alpha channels to make special effects. These textures can be made to look like fire, so that when many of them are layered on top of one another and moved, re-sized and re-coloured rapidly they look like realistic flames.

Modern systems use different approaches, but for BZ2's particle system the above is all you really need to know to get started. Once you understand that BZ2 makes effects using textures, you're already on your way.

TEXTURES
BZ2 includes many textures in its data.pak file. These textures are all used in battlezone II's 'stock' weapons and effects, and they are needed if you ever intend on using stock items in a mod. You should NEVER touch these textures, as many of them are used in the hard-coded parts of battlezone II and are required.

For example “vsmoke.tga” is used by battlezone II to texture light cones, and also functions as the moving backdrop in its menus and buttons (or 'shell'). The public beta patch splits this texture up so that you can use a different texture if you wish, but it's best to leave this as it is until you are more familiar with the other aspects of BZ2 modding.

You can make textures yourself with any good 2D editing program. A good texture will make it far easier to make a good effect. The stock textures are not brilliant, but they do provide a good library for you to get started with. To have a closer look at them, download “Pak Explorer” from http://www.bzscrap.com/downloads/utilities and open the data.pak file in youre root directory of battlezone II.

You can find all the textures used for effects in: Root/Effects. It may be useful to export them to 'MyDocuments' to ensure you dont damage the stock ones by accident. You can also edit the stock ones and place them in the 'addon' folder to use with you're own effects.

ODF FILES
In order to understand this tutorial you WILL need to be familiar with an ODF file and what it does. To cover this, look at other tutorials or open one in notepad and get thinking!

EXPLOSIONS

Explosions are the best way to begin because they cover almost all the ODF entires you need to learn for effects. Open a stock explosion in notepad and look at the general layout. Most will look like the following example:

// =============
// BAZOOKA GROUND EXPLOSION
// =============

This is the header. You can write anything you like here to remind you what the explosion is for. (any ODF line with two slashes in front of it will be ignored by BZ2.

[ExplosionClass]
classLabel = "explosion"

This is so that BZ2 knows what this particular ODF file contains. This file contains data for an explosion class. All you need to know is, this is neccesary and must be at the top of the file (or below the header).

ParticleTypes = #

particleClass# = ""
particleCount# = #
particleVeloc# = "0.0 0.0 0.0"
particleBias# = “0.0 0.0 0.0”

This section points BZ2 to the individual effects or “particles”, and can be used to define the direction or 'power' of the explosion. Note that in current versions of BZ2, you can point to 16 different particle types, but there are ways to increase this, albeit with limitations. These can point to effects within the same ODF file or in other ODF files.

explSound = "baz02.wav"
damageRadius = 50.0

damageValue(N) = 100 // none
damageValue(L) = 50 // light
damageValue(H) = 5 // heavy

damageValue(S) = 50 // standard
damageValue(D) = 100 // deflection
damageValue(A) = 5 // absorbtion

This section tells BZ2 what sound file to play when the explosion goes off. Note that this must be either an 8 or 16bit Mono sound with a maximum sampling rate of 44.1Khz. Sound files are covered in other tutorials. This section also tells BZ2 how much damage the explosion does to the different shield and armour types, and how far from the centre of the explosion the damage is given. The damage values shown here are the MAXIMUM damage that can be inflicted upon a unit in its damage radius. The damage that is actually given depends on how far away you are from the object.

Damage Given = Max Damage/Damage Radius * Distance From Explosion.

kickRadius = #
kickOmega = #
kickVeloc = #

This section is missed out in some explosion files, but can be used in BZ2 to inflict movement to surrounding vehicles when the explosion goes off. These are explained in more detail below.

After that, you will see the individual particles that make up the explosion. Before we get into that, let me explain the above entries in greater detail.

                      
Explosion ODF Entry Explanations

ParticleTypes= #
This can be a number from 1-16 and tells BZ2 how many particles you will have. If this number is smaller than the amount of particles you have made, you will NOT see them in game. If it is larger, BZ2 will not complain but it is always best to set it correctly.

ParticleClass[#= “”
This tells BZ2 where each particle can be found. An example would be “ParticleClass1 = “xgasxpl.smoke”. This will Tell BZ2 to find a file called “xgasxpl.odf” and look for a [smoke] header. Anything under the smoke header (until it finds another header) will be relevant to the “smoke” effect. Note that this is NOT case sensitive. To point to another particle at the same time, you will have to copy this line and change the number to 2, and change the 'smoke' to 'flame' for example.

ParticleCount# = #
This tell BZ2 how many times it should draw whatever is under the [header]. Using the previous example, if you set ParticleCount1 = 5, it will try to draw the items under [Smoke] 5 times. It is believed that this is limited to 25, but I have found that higher entries do work.

ParticleVeloc# = “0.0 0.0 0.0”
This is one of the more tricky settings, and essentially, tells BZ2 which direction and at what speed to 'move' the particle. Using the previous two examples, if I set this to ParticleVeloc1 = “5.0 6.0 7.0”, BZ2 will move the [Smoke] particle 5 metres per second to the right along the X axis, 6 metres per second upwards along the Y axis, and 7 metres per second 'closer' along the Z axis. You CAN use negative values to change the direction, so if I was to put a – in front of 6.0, the particle would move 6 metres per second DOWN the Y axis.

ParticleBias# = “0.0 0.0 0.0”
This setting's purpose is relatively unknown, but I believe it is used to inflict some kind of 'influence' on the particles depending on what angle the explosion starts at.

ExplSound = “”
This tells BZ2 what sound file to play when the explosion goes off. The sound will play ONCE, and will not loop repeatedly even if youre explosion lasts longer than the sound file. The file must be in .wav format, but is not a requirement. Use the setting as I have written it above to play no sound for this explosion.

DamageRadius = #
This tell BZ2 how far a vehicle need to be from the explosion to inflict damage. Note that this setting is essentialy ignored if all youre DamageValues are set to 0. This setting can be a decimal value if you wish. Maximum damage is inflicted upon a unit when it is right on top of the initial explosion (0 metres from it).

damageValue(N) = #
damageValue(L) = #
damageValue(H) = #
damageValue(S) = #
damageValue(D) = #
damageValue(A) = #

These settings tell BZ2 the MAXIMUM damage it can inflict upon a unit with the different armour types. For example, DamageValue(N) = 100 means that BZ2 can inflict a maximum of 100 hull damage to a vehicle without a shield and with an “armorClass  = N”.

N = None
L = Light
H = Heavy
S = Stasis Shield
D = Deflection Shield
A = Absorbtion Shield

Note that if D & N are set too 100, BZ2 will ONLY inflict 100 damage to a unit with no armour and a deflection shield.

KickRadius = #
The radius in which a possible 'kick' is applied to a unit. Any units outside of this radius will NOT receive a possible kick no matter how high the following two values are set.

KickOmega = #

The power of the kick and the force at which a moveable object within the kickRadius will move at. This setting really effects the 'spin' of a vehicle.

KickVeloc = #
The speed given to a moveable object within the kickRadius. This also gets smaller as the distance from the object gets larger.

[Header]
A header tells BZ2 where a particle is located. Anything below a header will be used in an effect until another header is found. The Header text can be replaced with almost anything you want, but its best to use text that will help you remember what the entries underneath are trying to draw (e.g., smoke, flame, fire, sparks, dust). They must also be DIFFERENT to one another if they are in the same .ODF file as one another. The best way to get around this is to add a number, e.g. [smoke2]

Particle Settings
These settings goes underneath the [Header]. This is what actually draws the particle. The following settings are used by explosions, and some but not all are used in other effects. Here they are:

SimulateBase = “”
This can be one of a few hard-coded things. This essentially tells BZ2 what sort of 'behavior' the particle should have, wether it moves constantly in one direction without being effected by gravity, wether it should not move at all, or wether it should move in a direction but take gravity into consideration. These are the possible entries:

SimulateBase = “sim_null”
This has no movement, and stays in one place, even if you have entries in the 'particleVeloc' entry, they will not be inflicted.

SimulateBase = “sim_smoke”
This particle moves in the direction specified by 'particleVeloc' without being effected by gravity.

SimulateBase = “sim_ember”
This particle moves in the directio nspecified by 'particleVeloc' and is effected by gravity. These particles will also bounce when they hit the ground, and will NOT expire when they hit the ground.

SimulateBase = “sim_chunk”
This doesn't seem to be any different from sim_ember in practice, but try it and see!
SimulateBase = “sim_dust”
This moves the particle across the ground in a direction and speed specified by 'particleVeloc'. It follows the terrain exactly and DOES NOT take height into consideration.

SimulateBase = “sim_spray”
I have not used this and ive never seen it used, so you'll have to play with it to see what it does exactly!

Lifetime = #
This usually follows simulatebase and dictates how long the 'life' of a particle is. It is also used to determine the speed at which a particle will move in a direction specified by 'particleVeloc'. The longer the lifetime, the SLOWER the particle moves (depending upon simulateBase). This must also be longer or equal to animateTime, but cutting it shorter can produce different results.

RenderBase = “”
Another limited setting with specific entries to choose from. This also determines how the particle behaves and how it draws. The available settings are the following:

RenderBase = “draw_twirl_trail”
Probably the most common. This draws the texture in 2D the same way it would draw it if you looked at it in an image program. draw_twirl_trail is used when a texture is used in a 'emitter' (covered later).

RenderBase = “draw_twirl”
Similar to “draw_twirl_trail”, but draws a more 'static' effect. draw_twirl is are used when a texture wants to be displayed normally and not used as an emitter.

RenderBase = “draw_light”
This is used to draw light. Note that drawing light will not affect the appearance of other explosions, but will be drawn on the surrounding terrain and objects. Lights is particles only work when lights are all switched on.

RenderBase = “draw_sphere”
This is used to draw a sphere. Textures on spheres are wrapped from the top to the middle, and the bottom the to middle. Draw sphere can be used to make realistic shocks and detail can be increased or decreased easily.

RenderBase = “draw_multi”
This is used so that a single particle can make more than one effect and can point to multiple effects. It is an essential render type in a non-explosion effect.

RenderBase = “draw_emit”
This is used to 'draw' an emitter. Multiple effects can be 'emitted' from this point. This doesn't draw anything visible, but provides an invisible 'point' where more effects can be drawn from. This is useful if you want effects to keep drawing after the explosion has passed, or if you want effects to 'move' but continue emitting. Useful when used in conjunction with draw_multi & draw_twirl_trail.

RenderBase = “draw_wave”
This is used to draw exactly what it describes, a 'wave'. You can see a very basic example by looking at the scion “sonic-wave” weapon. I believe that waves can be full circles if desired.

RenderBase = “draw_trail”
This is used to draw a 'cross' of two textures. Imagine drawing a + on paper then stretching it out towards you. The texture is stretched out along the flat parts. To ensure a texture is not stretched too much, trails are drawn in 'segments'. You can define the length and size quite easily.

RenderBase = “draw_bolt”
Similar to 'draw_trail', but does not draw over time, but all at once. Difficult to describe without examples.

RenderBase = “draw_planar”
Draws the texture flat on the ground. It will stretch out if terrain is higher, which is why marks always appear bigger on cliff sides.

RenderBase = “draw_geom”
Allows you to 'draw' 3D shape using a model .xsi and wrap a texture over it. The drawn model CAN be UV mapped also, but I dont believe this is neccesary.

RenderBase = “draw_sprite”
Draws the texture completely square, but differs from draw_twirl in that you can draw it a certain height and distance from the explosion centre.

TextureName = “”
This is the name of the texture file that the particle uses. Certain 'renderBase' entries do not support this. Textures should really be in .tga format, but dxtbz2, pic, bmp, png and other formats are supported. .tga is the most common.

TextureBlend = “”
Texture Blend is usually one of two things, although there are other entries. For the mean time, you only need to know the following, and a basic description of when they need to be used.

TextureBlend = “one one modulate”
Use this when youre texture has a large 'black' area that you want to be transparent. You do NOT need an alpha channel in the texture to use one one modulate, it will automatically make darker areas more transparent that lighter ones.

TextureBlend = “srcalpha invsrcalpha modulatealpha”
Use this when you want to draw grayscale and black items. Color can be used with limitations. Use this on textures that look like blank white squares, as they have what is known as an alpha channel. Note that these will be drawn OVER the top of 'one one modulate' items quite often.

StartColor
This determines how much of each color should be filtered into the texture when it is drawn and how transparent or opaque it should be. The first three numbers can range from 0-255, and represent Red, Green & Blue. The fourth number is usually between 0-255 and determines transparency for renders where a texture is used. This is filtered in as SOON as the texture is drawn, at the start of its lifespan.

NOTE: If you're drawing 'light', the fourth number is used to determine the brightness and therefore how visible it is. This is true to both middlecolor and finishcolor as well.

MiddleColor
There is some debate as to wether 'middlecolor' is actually supported. Personally I have not seen it ever have any effect. This works in the same way as startcolor, but when the particle is midway through its lifespan.

FinishColor
This determines how much of each color should be filtered into the texture when it is at the end of its lifespan.

FURTHER NOTE: The colors will fade into one another as the textures lifespan goes on. e.g, if you use:
Startcolor = “255 0 0 255”
FinishColor = “0 0 255 0”
it will first make the texture fully opaque and colorised red. As the textures lifespan passes, it will become less visible, and colorised more blue. If you set its lifespan to 2 using the above example, one second into the effect, it will be half-transparent and colorised half red and half blue.

StartRadius
Used to determine the 'size' of the texture when it is drawn. With lights, this is used as the lights range when it is first drawn. Note that this works the same way as color, in that it will 'fade' towards the finish radius. This can be any decimal value, and negative values and clamped to 0. For draw_geom, it determines the scale of the object when drawn.

FinishRadius
used to determine the 'size' of the drawn texture when it is drawn, and the range of lights when they reach the end of their lifespan. This can be any decimal value, and negative values are clamped to 0.

AnimateTime
used to determine how long it takes (in seconds) for the texture to go from start-finish. Note if this is LONGER than the lifespan, animate time will NOT automatically change its length. This can be useful if you want effects to dissapear before they turn completely invisible.

LIGHT ATTENUATION
Attenuation is used to define a 'loss' of something over distance. The following entries are ONLY used by draw_light.

AttenuateConstant = 0.0
AttenuateLinear = 0.0
AttenuateQuadratic = 0.0


These can be any positive decimal value, and essentially use different mathematics do dampen the light as it goes further from the scource. See http://www.wikipedia.org[/u]]http://www.wikipedia.org[/font] and search for 'light attenuation' to see some examples.

ROTATION
Rotation is a decimal value that allows you to make particles rotate when they are drawn. A positive value makes the texture rotate clockwise, while a negative value makes it rotate anti-clockwise. This is only used by draw_twirl & draw_twirl_trail. Rotation can make effects look much more 'active', but does increase load on youre processor. Use it sparingly.

For draw_twirl & draw_twirl_trail:
RotationRate = 0.0

For draw_sphere & draw_geom as of pb4a. These values are in degrees per second, initial represents the rotation applied to the item as soon as it is drawn, while the add represents the rotation added to the effect.

InitialYaw = 0.0
InitialPitch = 0.0
InitialRoll = 0.0

AddRoll = 0.0
AddYaw = 0.0
AddPitch = 0.0

SEGMENTS
These are neccesary entries for spheres, trails, bolts and waves.

For draw_sphere, these represent how many segments the sphere will have in longitudal and latitudal directions.

LongitudeSegments = 0
LatitudeSegments = 0

For draw_wave, these represent how many segments the wave is made up of. Wave angle is the change in angle between one wave segment from another, wave depth is how large each wave segment is, while wave segments represent how many segments there are in the wave.

waveAngle = 1.0
waveDepth = 0.3
waveSegments = 8

For draw_bolt & draw_trail. SegmentLength defines how long each segment of the bolt will be, segment variance determines the maximum amount of 'variance' between each drawn segment (note that segments will always be connected to each other regardless of the amount of variance), texture rate is the rate at which a texture 'scrolls' across the bolt.

segmentLength = 2.0
segmentVariance = "1.0 1.0 1.0"
textureRate = 0.01
segmentTime = 1.75 // only for draw_trail and I think it defines the lifetime for each segment.

MODELS
Only used by draw_geom, and is used to specify which model .xsi file you want to use for this effect. You MUST have the .xsi file extension.

GeomName = “”

MULTIPLE RENDERS
used only by draw_multi, and is used to point to each other effect that you want to draw. These are drawn at the same time. Render count defines the amount of other effects you want to draw using this particle, while the render names point to the ODF file first, and the [header] in the same way particleClass does.

RenderCount = #
RenderName1 = “xgasxpl.smoke” //looks for the file xgasxpl.odf, then the effect under the [smoke] header.

EMITTERS
Emitters are quite difficult to getyou're head around, but can be used to draw a texture multiple times, make it move in a direction, and define the lifespan and variation of it. Emitname is used only by draw_emit type particles. EmitLife defines the lifespan of each individual texture that is drawn. When this happens, lifespan is used to define how long the texture is 'emitted' for, rather than the lifespan of each drawn texture.

EmitVelocity is used to define a speed at which a texture moves at and its direction. If youre effect is designed to be very directional, I suggest you use this, but if you want it to be more random, use emitVariance. EmitInherit allows you to 'inherit' some direction from the emitters direction if it is moving already.

EmitDelay & EmitDelayVar are used to determine the time between each emission

EmitName = “xgasxpl.smoke” //used only by draw_emit, and points to the effect the same way particleClass does. Can point to a draw_multi type effect of another emitter if you wish.

EmitLife = 0.0 //in seconds
EmitDelay = 0.0 //in seconds, the time between each emission
EmitDelayVar = 0.0 //in seconds, the maximum variance in time between each emission, based on emitDelay
EmitVelocity = “0.0 0.0 0.0” //in metres per second in X,Y & Z directions.
EmitVariance = “0.0 0.0 0.0” //maximum variance amount in X, Y & Z directions.
EmitInherit = “0.0 0.0 0.0” // in X,Y & Z directions

The above six entries can be used in nearly all renderBase types to draw a texture multiple times. This can really help to fill out explosions and effects.


Effects are something you NEED to play with to understand.
« Last Edit: August 30, 2010, 03:42:00 AM by BNG » Logged

Many failures will take place in the process of attempting to achive your goal. It don't matter how many times you fail, Its how much you've learn each time since its apart of the learning process.
Pages: [1]   Go Up
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!