supcom

Weapons

Weapon Mechanics

A weapon consists of 3 parts:
  • Turret ( the weapon )
  • Rack
  • Muzzle

Cam shake

Aiming

Aiming is calculated with a combination of rack bones, muzzle bones and can have the option of being turreted in which case yaw, pitch and muzzle need to be defined in order for aiming to be accurate. Note that one of the most important parts of a weapon is the bone’s axis orientation and alignment with muzzle, racks and turrets. All aiming is done with the assumption that bones are oriented on a right hand orientation where the index finger is the Z axis and the thumb is the Y axis: We also need to keep close attention to the alignment of all the bones used in the weapon. A weapon needs for all its aiming bones’ Z axis to be coplanar and pointing along the same + or - direction.

Targeting / Firing

Category Strings are string that get converted to unit categories. They work exactly like the strings used for buildable categories. ie: You want TECH1 and MOBILE, the string would be 'TECH1 MOBILE'. If you wanted TECH1 and not MOBILE, it'd be 'TECH1 -MOBILE' and if you want LAND and AIR then you would do ‘LAND, AIR’ where the ‘,’ will be the union token.
 FireTargetLayerCapsTable = {
   Air = 'Land|Water',
   Land = 'Land|Water',
   Water = 'Land|Water',
 },
FireTargetLayerCapsTable allows you to pick which layers you can target in relation to the layer that you are currently at. For example, on the previous block, we can target land or water when we are on the air on land or on water.

<table of category strings that define the targetting order of this weapon></table>

Damage

Economy

Turrets

When a weapon needs to be turreted it means that we are going to use a turret to rotate its rack and muzzle and its aim will be dependant on those bones so the turret needs to define which bones are used for these rotations.
An important note to keep in mind is that if a weapon has both the pitch and yaw as the same bone then we require for the muzzle to be collinear If they are not the same bones then they only need to be coplanar. Another important situation that you might encounter is when we get an arm like set of bones like with bots. We need to make sure that all the weapon bones are coplanar and that the Muzzle bone’s z axis is collinear with the point defining the turret pitch Look at the following image to get a better idea of what is described here. The bone set up for the units is 100% the responsibility of the artist in charge of the mesh creation of the unit. Dual muzzle weapons are used with units that have 2 racks working in unison. We find this kind of weapons in bots. UEF light assault bot is a good example of a unit that has this type of weapon. Non-Turreted weapons are mainly set when you have seeking projectiles which do not require the weapon to have a particular direction and the projectile corrects the direction. A good example of such weapon is a torpedo from a sub. In this case the barrel and muzzle would be the same bone and the “Turreted” flag would be set to false. Look at unit URS0203 as an example.

Rack

Racks hold sets of muzzles with in them. You can have multiple sets of muzzles associated to a rack bone which will allow you manipulate their behavior with common attributes. Racks can have telescopes which mean their barrels can recoil at the barrel’s telescope bone. In addition it recoils the entire rack by a small distance. Some weapons like the big guns on Cybran Battleship have multiple sets. This unit fires each muzzle set individually and recoils the entire rack on every fire event. It also does not use a telescope but the result is very similar since we could think of the telescope bone as the rack bone.

Muzzle

The muzzle is the location (bone) of a piece of art that determines where a projectile or a beam comes out of the weapon.
We can have multiple muzzles per rack.

Salvo

Salvo is the ammo used by the rack. We need to define how they interact