Tutorial - Beam Weapons

From FreeSpace Wiki
Revision as of 15:38, 1 September 2006 by Wanderer (talk | contribs) (typo fix)
Jump to: navigation, search

This is a short tutorial into both making of beam weapons and in tweaking them. Some knowledge on table editing is usefull and as is basic understanding of Weapons.tbl.

Please post any comments or questions conserning the beam weapons tutorial to the talk page

Making a Basic Beam Weapon

Adding Beam Sections

Adding new beam sections is rather straightforward when it is done 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 wouldnt be completely defined. However if you define index for the beam section you can edit an existing beam section instead of adding 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 usefull in creating or editing beam weapon's table entry.


Type 0 Beams

Type 0 beams are basic straightfiring beam weapons without anything 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 certain target models size (or more precisely, octants) in determining the length of the slash and tend to miss fairly often. They also use +Miss Factor: values for determining weapon accuracy. Generally it is very rare occurrance if they cause full damage however slashing beams tend to damage ship subsystems as well as the hull 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.


Type 3 Beams

Type 3 beams have different behaviours depending on the type of its target. Against small targets, or more precisely against targets defined with this certain Objecttypes.tbl option, they fire a number of short beam pulses (defined with +Shots:) that have their total lifetime equal to the defined lifetime of the beam. Against larger targets they behave exactly like type 0 beams. In both cases the beam use +Miss Factor: values for it's 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 'swarm primaries' - that is they wont anything unless using extremely strict mission design - but with multi-part turrets function quite nicely. They do not +Miss Factor: values for determining weapon accuracy and this can make these beams exceesingly deadly however unlike other beam weapons these will become inaccurate if firing ship's weapons subsystem is damaged.

There are no examples of this beam type.


Adjusting Beam Ranges and Accuracy

Beam weapons use several different table options for setting the beam ranges.

Beam Targetting Ranges

Generally beams target any legal - that is anything not protected by other weapon settings such as 'huge' - target withing the set weapon range. However this range can be set by using +Weapon Range: and +Weapon Min Range: for setting the maximum and minimum targetting 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 use 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 and against how distant targets they fire the beam weapons.

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 targetting range then AI will start firing the beam against targets beyond its range.

Beam Accuracy

Normally beam accuracy is determined with +Miss Factor: that uses set accuracy values for each difficulty level. Higher values increase the change of beams missing their targets. However direct fire beams (type 2 beams as fighter beams or type 4 beams in turrets) use normal targetting 'rules'. That is they use the weapon velocity, target velocity, and range for calculating lead for the target. As beams are instantanous this causes the beams to miss their targets or rather AI to fire its' beams exactly in front of the target.

Adjusting Beam Textures

Beam textures are - by default - used ingame by stretching the single bitmap over the whole lenght of the beam. It is worthwhile to notice that if beam hits anything its length is limited to the impact point. This may cause very erratic beam texture behaviour if the bitmap used 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 in 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 tiles 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 set the length of the 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 shouldnt as probable as with the method '0'.

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 negative values cause the textures to move from firing point towars 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 doesnt do any damage in its set maximum range (defined with +Range:, not with +Weapon Range:).