Page contents

projectile

Projectiles are a type of object fired from weapons or thrown as grenades that interact with objects or map geometry. Through their parent object tag they can reference a model so they may have a visual element and/or a collision box. Projectiles have many properties and can interact with any material specified in the globals in various ways like bouncing or detonating.

Movement

Projectile movement is simulated during each game tick (smallest unit of simulated time). According to the projectile's velocity and gravity scale, its next position is calculated by the engine and a "trace" ray between the two points is tested for collisions.

The trace collision test takes advantage of other objects' bounding radii and the collision BSP structures found in collision models and scenario structure bsps. If any collision is detected, it is handled accordingly (e.g. applying effects, damage or playing sound).

If no collision is detected, the projectile is moved to its next position at the end of the trace line. The process continues, tick by tick, until the projectile collides or detonates at its maximum range

A sufficiently high velocity projectile is effectively hitscan if it can cross a playable space within a single tick, with the game being simulated at 60 ticks per second. Otherwise, ballistic leading will be required to hit a moving target.

Projectiles receive a boost to the distance hitscanned on their spawn tick, this boost is very strong at low velocities like 2, but as velocity increases the boost is reduced until it becomes negligible.

Projectile vectors can be changed from all sources of damage when a collision model is present by using the "instantaneous acceleration" value, this includes melee, explosions, normal rounds, and other projectiles colliding mid-air. When no collision is present only area of effect damage can effect projectiles

Introduced in H2, the "travels instantaneously" flag is used extensively by many weapons and makes projectiles reach short range targets in a much smaller amount of time, requiring less leading.

Flags

These are general purpose flags that change the behavior of the projectile, more specific flags for individual parts of the projectile can be found further down in their specific section. This section also contains properties related to projectile detonation behavior.

Weapon flagsDescription
oriented along velocityOrientation of projectile and it's attached effects so they match the direction it is moving, needed for proper and consistent bouncing behavior
AI must use ballistic aimingUsed in conjunction with the AI tag to allow the use of ballistic aiming to aim at targets, good for projectiles with a strong arc as otherwise the AI will attempt direct fire.
detonation max time if attachedWhen attached to a target, the detonation timer is set to the maximum possible value
has super combining explosionEnables supercombine functions on the projectile when attaching to targets
damage scales based on distanceCauses the impact damage to be scaled by the "air damage range" bounds values, needs more research
travels instantaneouslyUpon the projectile being fired from a weapon, its velocity is quadrupled for the first tick of creation, after the first tick it moves at it's assigned speed
steering adjusts orientationUnknown, generally causes the projectile when self-guiding onto a target to perform erratic sharp turns on near misses
don't noise up steeringWIP
can track behind itselfWIP
ROBOTRON STEERINGWhen tracking a target, the projectile will perform corkscrew motions, needs more research
affected by phantom volumesProjectile can interact with phantom volumes, rather than passing through them with no effect
expensive chubby testWIP
notifies target unitsWIP
use ground detonation when attachedUses the ground detonation field when this projectile is attached to bipeds, otherwise uses the airborne detonation
AI minor tracking threatUsed in conjunction with the AI tag to allow AI to react to this projectile via diving and dodging away from projectiles
dangerous when inactiveUnknown, needs additional research
AI stimulus when attachedTriggers special AI behaviors like fleeing or berserking when this projectile attaches to them
OverPeneDetonationAllows projectile to deal detonation damage when overpenetrating targets
no impact effects on bounce"impact effect" is disabled on bounce behavior
RC1 overpenetration fixesUnknown/Needs additional research

Is it not currently understood what defines a floor from a wall or ceiling, so far through testing a plane with an angle of 0 to 61 degrees is considered a floor and 90 degrees a wall

Detonation timer startsDescription
immediatlyThe moment the projectile is created it's detonation timer begins counting down
after first bounceProjectiles detonation timer counts down after first bounce off a floor
when at restDetonation timer begins counting down after the projectile comes to a full stop on a surface, timer does not stop if the projectile moves again after starting
after first bounce of any surfaceProjectiles detonation timer counts down after first bounce off any surface
Impact noiseDescription
silentUnknown/Needs additional research
mediumUnknown/Needs additional research
loudUnknown/Needs additional research
shoutUnknown/Needs additional research
quietUnknown/Needs additional research
FieldsDescription
collision radius (real)Unknown/Needs additional research

Detonation

FieldsTag/data typeDescription
arming timerealProjectile cannot detonate before this time: like preventing projectiles from blowing each other up too fast
danger radiusrealAI will try to avoid this projectile from this far away in WU
timerrealA set of two values in seconds that the projectile will pick randomly between to wait before detonation, timer starts according to the "detonation timer starts" selection
minimum velocityrealProjectile detonates when falling below this velocity
maximum rangerealProjectile detonates after having travelled this distance in world units
bounce maximum rangerealUnknown, needs additional research
detonation noiseenumSame as "impact noise" but applied on projectile detonation instead
super det. projectile countshortNumber of projectiles attached to a target needed to trigger super-combine behavior, needs supercombining flag enabled
super det. timerealTime after the above field where the super-combine effect is triggered
detonation startedeffectEffect played on the projectile during it's detonation timer countdown
detonation effect (airborne)effectEffect played on the projectile when it detonates in the air
detonation effect (ground)effectEffect played on the proejctile when it detonates on the ground
detonation damagedamage_effectDamage effect spawned when the projectile detonates
attached detonation damagedamage_effectDamage effect spawned on the target when this projectile is attached to them
super detonationeffectThe effect played when a super-combine is triggered from this projectile attaching to a target
super detonation damagedamage_effectThe damage effect spawned around the target the super-combine is being triggered on
detonation soundsoundSound played when the projectile detonates
damage reporting typeenumA dropdown list of various weapon types: unknown use
super attached detonation damagedamage_effectThe damage effect spawned on the target the super-combine is being triggered on
material effect radiusrealUnknown/Needs additional research

Flyby/impact

Defines what happens when the projectile flies past a target without hitting them, or if it hits them.

projectiles set to detonate when hitting targets will still apply impact damage before detonation damage

FieldsTag typeDescription
flyby soundsoundSound played near targets this projectile narrowly misses
impact effecteffectEffect played on all items and geometry when this projectile impacts them
object impact effecteffectEffect played only on objects such as crates or scenery when this projectile impacts them
impact damagedamage_effectDamage effect played on target the project impacts

Boarding fields

Defines properties when this projectile is planted onto boarded targets, all tags with a unit tag component such as vehicles or bipeds can be set to be boarded

FieldsTag/data typeDescription
boarding detonation timerealTime taken in seconds for the projectile to detonate after being planted while boarding
boarding detonation damagedamage_effectDamage effect spawned on the projectile after the above fields time has passed
boaring attached detonation damagedamage_effectUnknown/Needs additional research

Physics

This section defines the general properties about the projectile and how it travels to its target

AI velocity scale is broken and does not scale the velocity of projectiles down below 1, however AI targeting and leading still acts as if it is and as such AI will overlead targets and miss: scales above 1 work as intended

Forwards and backwards momentum from the player will be added onto the projectiles default velocity vector (positive or negative), however projectiles can not inherent momentum to move backwards when their velocity is a positive value or 0, while projectiles with a negative value can inherent momentum in for both vectors

FieldsData typeDescription
air gravity scalerealThis value defines how much drop the projectile experiences during flight, higher numbers mean more drop
air damage rangerealA set of two values that define how the associated damage is scaled, using the "damage lower bound" value for the air range past the latter bound value, behavior of this field is bugged for the former bound value and "damage upper bound" however.
water gravity scalereal
water damage rangereal
initial velocityrealThe velocity of the projectile when first spawned
final velocityrealThe velocity of the projectile after it has passed through it's "acceleration range"
ai velocity scale (normal)realScale on the projectiles velocity when fired by AI on normal
ai velocity scale (legendary)realScale on the projectile velocity when fired by AI on legendary, heroic is the average of both this and the normal difficulty value
guided angular velocity (lower)realThe amount of tracking the projectile has when below it's "acceleration range" value, scales towards the upper value during the "acceleration range"
guided angular velocity (upper)angleThe amount of tracking the projectile has when over it's "acceleration range" value
guided angular velocity at restangleAmount of tracking the projectile has when it first begins to track a target, needs additional research
acceleration rangerealA set of two values that determines at how manu WU's into the projectiles flight it should begin changing velocity, and at what range to have completed this transition
targeted leading fractionfractionA value from 0 to 1 that determines how much leading a tracking projectile will attempt when tracking a moving target
guided projectile (outer range) error radiusrealA value that determines the magnitude by which a tracking projectile will track away from it's target, this magnitude is scaled by the angular velocity values, once this max magnitude has been reached, normal projectile tracking torwards target begins: assuming the projectile is close enough to begin tracking, needs additional research
autoaim aiming max lead timerealUnknown, needs additional research

Material Responses

Projectiles moving faster than 1499 WU/s are unable to attach under any conditions and will detonate instead when making contact with target

This section defines how the projectile reacts when it comes into contact with specific materials

Default responseData typeDescription
impact (detonate)enumProjectile is deleted when it comes into direct contact with the material
fizzleenum
overpenetrateenumProjectile passes through through this material but only on objects and not map geometry
attachenumProjectile attaches to specified material, waiting the duration of the "timer" value in the detonation section
bounceenumProjectile bounces off of the specified material, bounce properties are specified further below
bounce (dud)enum
fizzle (bounce)enum

material name (string): string name of the material you are specifying the behavior for, materials are specified in the globals

potential response (enum): Same as the default response, but is the first place the game checks on projectile collision, if all conditions fail for potential, use default

Response flagsDescription
only against units (except giants)Run potential response if velocity and angle conditions pass when making contact with bipeds or vehicles
never against units (except giants)Never run potential response if projectile makes contact with bipeds or vehicles
never against wuss players
FieldsData typeDescription
chance fractionfractionA value between 0 and 1 that determines the chance for the "potential response" to be chosen, assuming below conditions are also true, else use "default response"
betweenboundsA set of values that determines at what impact angle the projectile must meet to continue with the "potential response", 0 being parallel and 90 being perpendicular, else use "default response"
andboundsA set of values that determines at what speed the projectile needs to be traveling at when it makes contact to continue with the "potential response", else use "default response"

Misc, penetration and reflection

Parallel and perpendicular friction act as a bounds where the closer to impact angle 0 a projectile makes contact, the closer it's velocity fraction lost gets to the "parallel friction" value, and vice versa with impact angles closer to 90 causing the velocity fraction lost to skew closer to the "perpendicular friction" value

FieldsData typeDescription
scale effects byenumAngle or damage, unknown
angular noiseangleUnknown, presumably the maximum number of degrees the projectile can be randomly offset by when bouncing off a surface (in addition to the natural offset from the bounce itself)
velocity noiserealUnknown, presumable the the velocity of the projectile changed randomly when bouncing off a surface (in addition to velocity lost from parallel and perpendicular friction values)
initial frictionrealUnknown, needs additional research
maximum distancerealUnknown, needs additional research
parallel frictionrealThe fraction of projectile velocity lost when bouncing off a surface at a parallel angle
perpendicular frictionrealThe fraction of projectile velocity lost when bouncing off a surface at a perpendicular angle

Brute Grenade

FieldsData typeDescription
minimum angular velangleUnknown, needs additional research
maximum angluar velangleUnknown, needs additional research
spin angular velangleUnknown, needs additional research
angular dampingrealUnknown, needs additional research
drag angle krealUnknown, needs additional research
drag speed krealUnknown, needs additional research
drag exponentrealUnknown, needs additional research
attach sample radiusrealUnknown, needs additional research
attach acc krealUnknown, needs additional research
attach acc srealUnknown, needs additional research
attach acc erealUnknown, needs additional research
attach acc dampingrealUnknown, needs additional research

Firebomb Grenade

projection offset (real): Unknown, needs additional research

Conical Spread

Pictured: 15 projectiles with a spread angle of 5 degrees and a distribution exponent of 0

Pictured: Now with the distribution exponent set to 1.2 with no other changes

Conical spread only works when the "travels instantaneously" flag is enabled and a value other than 0 is set for "maximum range"

This section can be used for weapons that fire a high volume of projectiles in a single shot, like shotguns: it defines the spread of the entire blast and the distribution of shots within the blast to allow more variability (how tight the grouping can be) compared to the error fields in the weapon tag

FieldsData typeDescription
yaw countshortThis value and the "pitch count" value are multiplied together to get the total number of projectiles created for conical spread, unknown if any other effects
pitch countshortSee above
distribution exponentrealDefines the distribution of projectiles within the "spread" angle, a value of 0 means all projectiles are set along the max of the spread value, higher velues make this distribution closer to center
spreadangleDefines the max spread in degrees from center

Acknowledgements

Thanks to the following individuals for their research or contributions to this topic:

  • gbMichelle (movement from the CE projectile tag)
  • odchylanie_uderzenia (writing and research)