Tutorial - Beam Weapons
This is a short tutorial into making of beam weapons. Some knowledge on table editing is useful and as is basic understanding of Weapons.tbl.
Please post any comments or questions concerning the beam weapons tutorial to the talk page
Contents
Making a Basic Beam Weapon
Setting Basic Values
$Name: S-AAA-Weak $Model File: none ; laser1-1.pof @Laser Bitmap: laserglow01 @Laser Color: 250, 30, 30 @Laser Length: 0.0 @Laser Head Radius: 0.60 @Laser Tail Radius: 0.60
Only actually meaningfull of these arguments is the $Name:, others are not used with beam weapons.
$Mass: 100.0 $Velocity: 1000.0 $Fire Wait: 5.0
$Mass: value is used with beams to define the force with it pulls (negative value) or pushes (positive value) the target. Setting to zero prevents 'beam whacking'.
$Velocity: value is not as important with beam weapons as it is with other weapons as it is only used for determining targeting range and also, for certain beam types, the accuracy of the beam.
$Fire Wait: value set the delay between invidual beam firings.
$Damage: 5 $Armor Factor: 1.0 $Shield Factor: 1.0 $Subsystem Factor: 1.0
When creating beam weapons it is very important to notice that the defined damage is the continous damage. To get damage caused per second you must multiply this value by 5.5. Also to get full damage potential of the beam you have to first multiply the damage with the 5.5 and then with the beam life value. Other values are used as with other weapons to determine damage multipliers against hull, shield, and subsystems.
$Lifetime: 60.0 $Energy Consumed: 0.30 $Cargo Size: 0.0 $Homing: NO $LaunchSnd: 124 $ImpactSnd: 88 +Weapon Range: 1500 $Flags: ( "Big Ship" "beam" )
$Lifetime: argument is used with beams for the same purposes as the earlier $Velocity: argument.
$Energy Consumed: affects only fighterbeams and defines the rate at which they consume ship weapon bank energy.
$Flags: is used to give certain parameters to the weapon. Beam weapons must have the "beam" flag.
$Icon: icongun05 $Anim: LoadGun07 $Impact Explosion: ExpMissileHit1 $Impact Explosion Radius: 10.0
$Impact Explosion: and $Impact Explosion Radius: are used to define the explosion effect and its size on the target should the beam hit something.
Setting Beaminfo Values
+Type: 3 +Life: 3 +Warmup: 500 +Warmdown: 1000 +Radius: 10.0 +PCount: 15 +PRadius: 1.2 +PAngle: 65.0 +PAni: particleexp01 +Miss Factor: 6.0 5.0 4.0 3.0 1.5 +BeamSound: 121 +WarmupSound: 122 +WarmdownSound: 123 +Muzzleglow: thrusterglow01 +Shots: 3 +ShrinkFactor: 0.0 +ShrinkPct: 0.0 $Section: +Width: 1.0 +Texture: beam-red +RGBA Inner: 255 255 255 255 +RGBA Outer: 150 150 150 10 +Flicker: 0.1 +Zadd: 2.0
See $BeamInfo: in Weapons.tbl
Adding Beam Sections
The process of adding new beam sections is rather straightforward when it is done directly with Weapons.tbl, however there may be problems when using *-wep.tbms to add or change existing beam sections if the additional +Index: table option is not properly used. If no index number is given to a beam section in *-wep.tbm game assumes it to be an additional beam texture even if it wouldn't be completely defined. However if you define index for the beam section you can edit an existing beam section in addition to creating new ones.
Different Beam Types
Beam types in FreeSpace open are clearly different from each other. Understanding their differences and also their unique features is useful in creating or editing beam weapon's table entry.
Type 0 Beams
Type 0 beams are basic straight firing beam weapons without any additional features. They use +Miss Factor: values for determining weapon accuracy. Generally if they hit their target they will cause full damage. Type 0 beams do not function as fighter beams.
Few examples are SGreen, BGreen and BFRed.
Type 1 Beams
Type 1 beams are slashing beams. These beams use target's size (or more precisely, models octants) in determining the length of the slashing movement. They might (not sure) also use +Miss Factor: values for determining weapon accuracy. Generally it is very rare occurrence if they cause their full listed damage to the target as the slash usually goes wide of the target in both the starting and ending points of the slashing movement. However slashing beams tend to damage target's subsystems quite efficiently unlike type 0 beams. Type 1 beams do not function as fighter beams.
Few examples are TerSlash, and VSlash.
Type 2 Beams
Type 2 beams are direct fire beams. When mounted on turrets they operate as type 0 beams however they can be used as fighter beams. When used as fighter beams they disregard any +Miss Factor: settings.
The only example is Targeting Laser (sort of)
Type 3 Beams
Type 3 beams are also known as anti-fighter beams and unlike other beam types they have different behaviours depending on the type of its target. Against small targets, or more precisely against targets defined with certain Objecttypes.tbl option, they fire a number of short beam pulses (defined with +Shots: that have their total combined lifetime equal to the defined lifetime of the beam. Against larger targets they behave exactly like type 0 beams. In both cases the beam uses +Miss Factor: values for its accuracy. Type 3 beams do not function as fighter beams.
Few examples are AAAf, and SAAA.
Type 4 Beams
Type 4 beams are direct fire beams that fire only along the firing turrets normal. If mounted on single-part turret they will only fire where that turret's normal is pointing in similar manner as the unguided swarm weapons - that is they wont hit anything unless using extremely strict mission design - but with multi-part turrets they function quite nicely. They do not use +Miss Factor: values for determining weapon accuracy and this can make these beams exceedingly deadly however unlike other beam weapons these will become inaccurate if firing ship's weapons subsystem is damaged.
The only example is MjolnirBeam's fixed version.
Adjusting Beam Ranges and Accuracy
Beam weapons use several different table options for setting the beam ranges.
Beam Targeting Ranges
Generally beams target any legal - that is anything not protected by other weapon settings such as 'huge' - target within the set weapon range. However this range can be defined by using +Weapon Range: and +Weapon Min Range: for setting the maximum and minimum targeting ranges respectively. It should be also noted that beams do use the range calculated for other weapons as well (lifetime x velocity) despite the fact they actually do not need these values for anything else. That if the lifetime x velocity is smaller than the set weapon range then beam uses the lifetime x velocity for determining the maximum range. AI uses this range for determining when to fire the beam weapon.
Actual Beam Range
Normally beam range is 30 000 m. This can however be adjusted using +Range: option under $BeamInfo: in weapons.tbl. This effectively stops or rather dissipates (not a sharp ending) the beam at that range. It is worth noting that if the actual beam range is shorter than the set beam targeting range then AI will start firing the beam against targets beyond its range.
Beam Accuracy
Normally beam accuracy is determined with +Miss Factor: values that uses set accuracy values for each difficulty level. Higher values increase the chance of beams missing their targets. However direct fire beams (type 2 or type 4 beams as fighter beams and type 4 beams in multi-part turrets) use normal targeting 'rules'. That is they use the weapon velocity, target velocity, and range for calculating lead for the target. As beams are instantaneous this causes the beams to miss their targets or rather AI to fire its beam to a point exactly in front of the target.
Adjusting Beam Textures
Beam textures are - by default - used in game by stretching the single bitmap over the whole length of the beam. It is worthwhile to notice that if beam hits anything its drawing length is limited to the distance from the firing point to the impact point. This may cause very erratic beam texture behaviour if the used bitmap was not uniform. Animations (both .ani and .eff) can be used instead normal bitmaps for beams textures.
Adjusting Tile Length
Instead of letting the game stretch the bitmap over the whole length of the beam the tiling of the beam texture can be adjusted with two different methods. To use these methods for adjusting beam texture tiling we have to use +Tile Factor: option under the beam section that is to be modified. Tile factor requires two arguments of which the first one (either 0 or 1) will determine the actual texture tiling method.
Tiling Method '0'
Method '0' sets the beam texture to be tiled in similar way as the default method but with one difference. You can define how many times the texture tile is used in beam - default option is the same as +Tile Factor: 0, 1. However stretching is again possible issue.
Tiling Method '1'
Using method '1' for setting the beam texture tiling allows us to use the second value to define the length of the beam tiles used in the beam texture. So when using this method the number of tiles shown on screen does depends on the length of the beam and stretching issues shouldn't as visible at all.
Setting Beam Translation Values
Translation values allow us to move the beam tiles without actually using animations with them. The translation is set with +Translation: option under the beam section that is to be modified. Positive values cause the textures to move from the impact point towards the firing point and respectively negative values force the textures to move from firing point towards the impact point.
Beam Damage Attenuation
Damage from the beam weapons can be set to attenuate using the +Attenuation: option under the $BeamInfo:. It determines the point from where the damage attenuation begins. It accepts values from 0 to 1. With 1 the attenuation has no effect at all as the then the attenuation 'starts' at the maximum range of the beam. When using 0 however the damage attenuation starts from the firing point so that the beam doesn't do any damage in its set maximum range (defined with +Range:, not with +Weapon Range:).