Tutorial - Beam Weapons

From FreeSpace Wiki
Revision as of 20:28, 11 February 2011 by Asterpth (talk | contribs) (Setting Basic Values)
Jump to: navigation, search

This is a short tutorial detailing the exact functions of various parameters for Beam weapons in Weapons.tbl. Some knowledge on table editing is useful as well as having a basic understanding of Weapons.tbl.

Please post any comments or questions concerning the beam weapons tutorial in the Discussion Page.

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

$Name: is obviously the name of the weapon, this is the name you will be giving FRED for weapons.

@Laser Color affects the color that the beam lights up surrounding objects when it fires.

$Mass:                            100.0
$Velocity:                        1000.0
$Fire Wait:                       5.0

$Mass: value is used with beams to define the force with which it pulls (negative value) or pushes (positive value) the target. Setting to zero prevents 'beam whacking'.

$Velocity: value is used for determining targeting range and also, for certain beam types, its accuracy.

$Fire Wait: value set the delay between individual beam firings in seconds.

$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 continuous. 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 hulls, shields 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 fighter beams 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
	+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 with using *-wep.tbms to add or change existing beam sections if the additional +Index: table option is not used properly. If no index number is given to a beam section in the *-wep.tbm, the 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 unique features is useful for all tablers.

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 speaking, if they hit their target, they will cause full damage. Type 0 beams do not function as fighter beams.

SGreen, BGreen and BFRed are Type 0 beams.

Type 1 Beams

Type 1 beams are slashing beams. These beams use the target's size (or more precisely, models octants) in determining the length of the slashing movement. They might also use +Miss Factor: values for determining weapon accuracy. Only on very rare occasions do slash beams inflict full damage, as they go wide off 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.

TerSlash and VSlash are 'slashing beams'.

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 the +Miss Factor: value.

The only example is the Targeting Laser.

Type 3 Beams

Type 3 beams are also known as anti-fighter beams and unlike other beam types, they have different behaviors depending on the type of its target. Against small targets, or more precisely against targets defined with certain Objecttypes.tbl options, 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.

AAAf and SAAA are such beams.

Type 4 Beams

Type 4 beams are direct-fire beams that fire only along the firing turret's normal. If mounted on a 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 won't 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 the firing ship's weapons subsystem is damaged.

The only example is the MjolnirBeam's fixed version.

Adjusting Beam Ranges and Accuracy

Beam weapons use several different table options for setting their effective ranges.

Beam Targeting Ranges

Generally speaking, beams target anything not protected by other weapon settings such as 'huge' 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. If the lifetime x velocity is smaller than the set weapon range then beam uses the lifetime x velocity for determining its maximum range. The AI uses this range for determining when to fire the beam weapon.

Actual Beam Range

Beam range is 30 000 m under standard circumstances. This can, however, be adjusted using the +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, the AI will start firing the beam against targets beyond its range.

Beam Accuracy

Normally, beam accuracy is determined by +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 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 behavior 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: under the beam section. Tile factor requires two arguments of which the second 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: 1, 0. However, stretching is again possible.

Tiling Method '1'

Using Method #1 for setting the beam texture tiling allows us to use the first 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 shouldn't be 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 the +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 negative values force the textures to move from the 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:).