TFE Projectile Data

From DF21 Wiki
Revision as of 23:09, 29 November 2024 by Jerethk (talk | contribs)

Projectile data is hardcoded in Dark Forces but the data has been externalised to a JSON file in The Force Engine. The data is located in ExternalData\DarkForces\projectiles.json.

Altering the data in projectiles.json will alter the way that weapon projectiles behave in the game. If the JSON file is removed, renamed or corrupted, weapons will not work correctly. (In this case, an error message will be logged to the TFE console when loading the game.)

Note that all text in the JSON is case insensitive (uppercase, lowercase or a mixture may be used). The projectiles and their properties can be listed in any order.

Mods

A customised version of projectiles.json can be included in a mod's ZIP file. A modded projectiles.json will take precedence over the base version.

Modded versions of projectiles.json need to include definitions for all 19 of the Dark Forces projectiles. If any projectile definitions are missing, those projectiles will not work.

Projectile properties

Each projectile type can have the following properties defined. This table lists the properties and what they mean.

Property Type Default value Description
assetType string "spirit" The type of asset that the projectile uses. It must be one of the following: "spirit", "frame", "sprite" or "3d". (A spirit is an invisible object that has no asset.)
asset string A .FME, .WAX, or .3DO file. The type must match the assetType. If the assetType is spirit, this property can be left unset and will be ignored.
fullBright boolean false Whether or not the asset will be rendered fullbright.
zeroWidth boolean false If true, the projectile will not have a collision radius. Most projectiles have zero width.
autoAim boolean false If true, the player's weapons will auto-aim at the projectile. (This applies to Mohc's homing missiles because they can be shot down.)
movable boolean false If true, the projectile will be moved by elevators. For example if you lay a mine on a rotating sector, the mine will rotate with it.
updateFunc string "standard" This defines how the projectile will travel through space. There are four options.
  • standard - The projectile will move in a straight line.
  • arcing - The projectile will be pulled downwards by gravity (thermal detonators and mortars)
  • landmine - Used for landmines
  • homing - A homing projectile.
damage number (integer) 0 Maximum damage caused by the projectile (equivalent to hitpoints). The projectile will cause this amount of damage before any falloff occurs. Note that some projectiles are set to zero damage because damage is inflicted by their explosions rather than by the projectile itself.
falloffAmount number (decimal) 0 Damage falloff amount
nextFalloffTick number (integer) 0 Number of ticks (after projectile is spawned) before first damage falloff occurs. There are 145 ticks per second.
damageFalloffDelta number (integer) 0 Time interval (in ticks) between subsequent damage falloffs.
minDamage number (integer) 0 Minimum damage caused by the projectile. Once the damage has fallen off to this value, no further falloff will occur.
force number (decimal) 0 How much the projectile will "push" an object on impact. Is multiplied by the projectile's speed.
speed number (integer) 0 The initial speed of the projectile. DFU per second.
horzBounciness number (decimal) 0 Defines how much of the projectile's speed is retained after it bounces off a wall. A bounciness of 1.0 means that the projectile will maintain the same speed after bouncing; numbers less than 1.0 mean that the projectile will lose speed. (Setting bounciness to a value greater than 1.0 will cause the projectile to gain speed when bouncing!) Bounciness is only calculated when bounceCount is -1 (in practice, this means that it is only used for Thermal detonators).
vertBounciness number (decimal) 0 Defines how much of the projectile's speed is retained after it bounces off a ceiling or floor. See above.
bounceCount number (integer) 0 Number of times that a projectile can bounce or reflect off a surface. If set to a positive value, the projectile will only bounce in a sector with the "magseal" flag set. If set to 0, the projectile will never bounce; it will explode on first impact. If set to -1, the projectile can bounce an infinite number of times until its time expires, and it will bounce in any sector (whether magseal or not). BounceCount is set to -1 for thermal detonators.
reflectVariation number (integer) 0 Affects how much the projectile will change direction when it bounces.
duration number (decimal) 0 How long (in seconds) the projectile will exist before expiring. For proximity landmines, this value is the time interval before the mine becomes "live".
angularSpeed number (integer) 0 The initial angular speed of a homing projectile (i.e. Mohc's missiles). This is how sharply the projectile is able to turn as it homes in on the player.
flightSound string no sound Looping sound effect (VOC file) that is played as the projectile travels.
reflectSound string no sound VOC file that is played when the projectile bounces off a surface
cameraPassSound string no sound VOC file that is played when the projectile passes the player/camera
reflectEffect string Effect (explosion) that is spawned when the projectile bounces off a surface.
hitEffect string Effect (explosion) that is spawned on impact.
explodeOnTimeout boolean false If true, the projectile will explode (spawn its hitEffect) if it times out (as defined by the duration property). If false, the projectile will simply disappear when it times out.