ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

MissileSpawn Control

From ModEnc
(Redirected from DMislBodyLength)
Jump to navigation Jump to search

Starting from Red Alert 2, the TS engine has a Spawns system and added a type of spawned missile. Unlike ROT-type projectiles, they are AircraftTypes with Locomotor={B7B49766-E576-11d3-9BD9-00104B972FE8} (Rocket) to enable this ballistic missile movement mode and use the following parameters to specifically adjust the trajectory.

Available flags

In vanilla, the flags used by these spawned missiles are listed under the global [General] and [CombatDamage] sections. In Red Alert 2, there are only two types of spawned missiles: V3 Rocket used by V3 Launcher and Dread Missile used by Dreadnought and Vladimir's Dreadnought, so there are only two sets of statements: V3Rocket* and DMisl*. In yr, a new spawned missile used by Yuri Boomer was added, so another set of flags named CMisl* was added. In Ares, this was changed to define them using the same flags on each AircraftType, rather than under [General] and [CombatDamage], and more content was expanded.

Tip
The game first checks if the type matches what is filled in V3RocketType=. If yes, it uses the data from the V3Rocket* group.
If it is Yuri's Revenge, then it checks if the type matches what is filled in CMislType=. If yes, it uses the data from the CMisl* group.
For all other types, it uses the data from the DMisl* group.

Opening flag

[General]
V3RocketType=V3ROCKET             ; AircraftType
DMislType=DMISL                   ; AircraftType
CMislType=CMISL                   ; AircraftType

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Custom=no                 ; boolean

In vanilla, through three flags under [General], each specifying a aircraft, when this aircraft uses Locomotor=Rocket, it will use the corresponding data.

  • For example, the aircraft specified in V3RocketType= will use data filled in global flags like V3RocketPauseFrames that belong to the V3Rocket* group.

In Ares, by adding Missile.Custom=yes to any AircraftType, it will use a group of Missile.* data written under this unit when Locomotor=Rocket is used.

Note
If you intend to override the original missiles defined as V3RocketType, DMislType and CMislType, you also have to define the new flags introduced by Ares. Ares will not default to the original game flags for these types defined in the [General] section.

Warning
Ares broke something when extending Custom Missiles, so that only aircrafts work properly. If a vehicle uses Locomotor=Rocket, it will cause a Fatal Error during takeoff.

Before launch

PauseFrames

[General]
V3RocketPauseFrames=0             ; integer
DMislPauseFrames=20               ; integer
CMislPauseFrames=20               ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.PauseFrames=0             ; integer

Defines how many frames the missile pauses on the launching unit before tilting.

TiltFrames

[General]
V3RocketTiltFrames=60             ; integer
DMislTiltFrames=60                ; integer
CMislTiltFrames=100               ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.TiltFrames=0              ; integer

Defines how many frames it takes for the missile to tilt to firing position.

PitchInitial

[General]
V3RocketPitchInitial=0.21         ; float
DMislPitchInitial=0               ; float
CMislPitchInitial=1               ; float

[SOMEAIRCRAFT]                   ; AircraftType
Missile.PitchInitial=0.0          ; float

Defines the starting pitch of the missile before tilting up.

PitchFinal

[General]
V3RocketPitchFinal=0.5            ; float
DMislPitchFinal=0.5               ; float
CMislPitchFinal=1.0               ; float

[SOMEAIRCRAFT]                   ; AircraftType
Missile.PitchFinal=0.0            ; float

Defines the ending pitch of the missile after tilting up and when firing.


Before launch, the spawned missile will first remain stationary at its initial creation position at the angle defined by PitchInitial for the number of frames defined by PauseFrames. Then, within the number of frames defined by TiltFrames, it will rotate clockwise along the X-axis as viewed from the left side of the unit to the angle specified by PitchFinal, and then launch.

Tip
Here, Pitch uses a right angle measure, where 1.0 represents a 90-degree angle, or in other words, perpendicular to the ground.

In addition, Pitch is a value that increases proportionally starting from 0.0 as the unit's forward direction, and it is not a periodic function that takes modulo 4.0 to obtain an angle within 360°. That is to say, values of 1.5 and 3.5 both point to 145°, but they are not the same behavior; the latter will rotate an extra full circle.

The number of circles rotated is given by:

(PitchFinal - PauseFrames) / 4.0

The rotation speed is obtained by dividing the required rotation angle by TiltFrames.

After launch

Acceleration

[General]
V3RocketAcceleration=0.4          ; float
DMislAcceleration=0.8             ; float
CMislAcceleration=1.0             ; float

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Acceleration=0.0          ; float

Defines how much is added to the missile's velocity each frame during launch.

  • If the acceleration is too small, it may cause the spawned missile to remain at the position before launch.

LazyCurve

[General]
V3RocketLazyCurve=yes             ; boolean
DMislLazyCurve=no                 ; boolean
CMislLazyCurve=no                 ; boolean

[SOMEAIRCRAFT]                   ; AircraftType
Missile.LazyCurve=no              ; boolean

Whether the missile's path is a ballistic curve like the original V3 rocket. Otherwise the missile maintains the defined altitude.

Note
It is common knowledge, obvious even to ordinary middle school students, that if the initial angle is perpendicular to the directrix, then a parabolic missile will never intersect the ground again. That is, if PitchFinal is perpendicular to the ground, then a spawned missile with LazyCurve=yes will ascend vertically, flying higher and higher, never to fall back to the ground.

For the spawned missiles with LazyCurve=yes, since they use a parabolic trajectory, their trajectory depends only on PitchFinal and the distance to the target. Next, you can directly proceed to the next section to read.

  • If the PitchFinal angle modulo 360° is still in the second quadrant, then it will still use the distance to the target to determine the speed; however, because the rotation rates for clockwise and counterclockwise are different when reaching the top, only the ascent phase is a standard symmetric trajectory.
Under LazyCurve=yes, two spawned missiles with PitchFinal=0.5 and PitchFinal=1.5, having symmetrical ascent phase trajectories.

If LazyCurve=no, then this spawned missile belongs to Cruise Missile, and their trajectories are generally divided into three phases and are controlled by the following flags.

Cruise Missile (LazyCurve=no) Only

TurnRate

[General]
V3RocketTurnRate=0.05             ; float
DMislTurnRate=0.08                ; float
CMislTurnRate=0.10                ; float

[SOMEAIRCRAFT]                   ; AircraftType
Missile.TurnRate=0.0              ; float

Defines the pitch maneuverability of the missile in air.

  • Generally speaking, this should be a positive value so that spawned missiles can level off after rising to a sufficient height and, after flying horizontally to a position determined by the value set by Altitude and a fixed descent angle together, pitch down to turn towards the target. but you can certainly set a negative value to achieve some interesting effects.
Example of using a negative TurnRate value: when, after reaching level flight altitude, the angle is not reduced but instead increased, ultimately resulting in a spawned missile circling around the X-axis in the sky

Altitude

[General]
V3RocketAltitude=768              ; integer
DMislAltitude=768                 ; integer
CMislAltitude=768                 ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Altitude=0                ; integer

Defines the cruising altitude in leptons at which height missile begins leveling off.

Hit Judgment - BodyLength

[General]
V3RocketBodyLength=256            ; integer
DMislBodyLength=128               ; integer
CMislBodyLength=128               ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.BodyLength=0              ; integer

Defines how long the body of the missile is in leptons. When the distance of so many leptons in front of the spawned missile has contacted the target or terrain, it is deemed that a collision has occurred and the missile is detonated at the point of impact.

Cause damage

Damage

[General]
V3RocketDamage=200                ; integer
DMislDamage=300                   ; integer
CMislDamage=200                   ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Damage=0                  ; integer

Defines how much damage the missile does when launched from a rookie or veteran unit.

EliteDamage

[General]
V3RocketEliteDamage=400           ; integer
DMislEliteDamage=600              ; integer
CMislEliteDamage=250              ; integer

[SOMEAIRCRAFT]                   ; AircraftType
Missile.EliteDamage=0             ; integer

Defines how much damage the missile does when launched from an elite unit.

Warhead

[CombatDamage]
V3Warhead=V3WH                    ; WarheadType
DMislWarhead=DMISLWH              ; WarheadType
CMislWarhead=CMISLWH              ; WarheadType

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Warhead=none              ; WarheadType

Defines the warhead the missile uses to deliver damage when launching from a rookie or veteran unit.

EliteWarhead

[CombatDamage]
V3EliteWarhead=V3EWH              ; WarheadType
DMislEliteWarhead=DMISLEWH        ; WarheadType
CMislEliteWarhead=CMISLEWH        ; WarheadType

[SOMEAIRCRAFT]                   ; AircraftType
Missile.EliteWarhead=none         ; WarheadType

Defines the warhead the missile uses to deliver damage when launching from an elite unit.

Special - Raise Rate (CMisl Only)

[General]
V3RocketRaiseRate=1               ; float
DMislRaiseRate=1                  ; float
CMislRaiseRate=1                  ; float

[SOMEAIRCRAFT]                   ; AircraftType
Missile.RaiseRate=0.0             ; float

Defines how much the missile will raise each turn on the launching unit.

Warning
In fact, this can only be used for objects filled in CMislType=, probably due to rushed development, this feature was not perfected. Later, during Ares development, the working logic was not deeply analyzed. Therefore, currently, neither V3RocketRaiseRate, DMislRaiseRate, nor Missile.RaiseRate introduced by Ares are valid.

This pattern is only used for the Cruise Missile of Yuri Boomer in vanilla. Specifically, it does not have a Tilt phase before launch. Instead, it uses the sum of CMislPauseFrames and CMislTiltFrames to obtain a Pause phase. During this phase, the spawned missile maintains the angle of CMislPitchInitial, rises vertically at the speed of CMislRaiseRate, and creates a takeoff animation at 24-frame intervals until the Pause phase ends. Then, it instantly switches to the angle determined by CMislPitchFinal and begins to execute the conventional launch steps.

Although it was customized for the spawned missile named Cruise Missile, this working pattern is not limited to spawned missiles set as cruise missiles via CMislLazyCurve=no. However, the starting point of the parabola will be the position in the air at the end of the Pause phase.

Use CMislRaiseRate when CMislLazyCurve=yes

Launch Coordinates

The rules for the spawner unit to create spawned missiles are determined as follows:

  1. The first spawnee uses the coordinates defined by (Elite)PrimaryFireFLH=.
  2. For the second spawned missile, there are two cases:
    1. If the launcher weapon has Burst=2, then use the position like a conventional weapon, F, -L, H.
    2. If the spawner unit has set SecondSpawnOffset in art(md).ini, then use the coordinates determined by SecondSpawnOffset=.

Extended content

Using weapons to cause damage

In vanilla, spawned missiles can only cause damage using warheads, therefore they cannot create a rad site merely through impact. To this end, Ares has added some options to allow detonating a weapon upon impact.

  • This weapon is detonated instantly and does not deploy a projectile.

Instead of using the pair of damage and warhead settings to deliver damage, it is also possible to define a weapon that will fire when the missile explodes. The weapon is used to control projectile, warhead, damage and bright settings of a bullet that detonates immediately.

Note
Missiles will not fall back to Missile.Weapon for elite units in case Missile.EliteWeapon is not set. Missile.EliteDamage and Missile.EliteWarhead are used instead.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Weapon=none               ; WeaponType

The weapon used to deliver damage. If not set, Missile.Damage and Missile.Warhead are used to create the explosion.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.EliteWeapon=none          ; WeaponType

The weapon used to deliver damage. If not set, Missile.EliteDamage and Missile.EliteWarhead are used to create the explosion.

Customize Trailer and Take-Off Animations

In vanilla, spawned missiles fixedly use [V3TAKOFF] as the launch animation and [V3TRAIL] as the trail animation, generated at 3 frames intervals. Although you can use Trailer to add a trail animation like for ordinary aircrafts and use SpawnDelay to control the interval, the trail for spawned missiles is actually a separate creation method, meaning that if you do that, both smoke trails will be generated at their respective set intervals. In Ares, this is now allowed to be freely defined.

Note
These settings can be used for any missile, whether they are custom or not.

Aside from the missile settings you can customize the takeoff and trailer animations. Ares also optimizes away the lookup of the animation types, thus it does not happen each time a new animation is to be created for each missile.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.TakeOffAnim=none          ; AnimationType

Defines the optional animation played when the missile takes off.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.TrailerAnim=none          ; AnimationType

Defines the optional animation that is used to draw the trailer of this missile.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.TrailerSeparation=3       ; integer

Defines the number of frames to the creation of another trailer animation.

Spawn Interval

In vanilla, the interval for a spawner unit to create a spawnee is hard-coded; for spawned missiles it is 9, and for true shipboard aircraft it is 20. Therefore, regardless of the ROF on the launcher weapon, the spawnee cannot be generated quickly. Starting from Phobos Build #34, this interval can be freely defined.

[SOMETECHNO]                     ; TechnoType - spawner unit
Spawner.DelayFrames=              ; integer

Set the minimum number of game frames in between each spawn ejecting from the spawner.

Initial Orientation

In vanilla, both spawned missiles and true shipboard aircraft would use the spawner unit's body direction when created. Starting from Phobos Build #47, this has been changed to an optional setting for whether to use the turret's direction. A similar design exists for Kratos.

In Phobos:

[SOMETECHNO]                     ; TechnoType - spawner unit
Spawner.UseTurretFacing=no        ; boolean

If set, makes spawned aircraft face the same way as turret does upon being created if the spawner has a turret.

In Kratos:

[SOMEAIRCRAFT]                   ; AircraftType
Missile.FacingTarget=no           ; boolean

Whether to use the relative direction of the target instead of using the body direction of the spawner unit.

Traceable spawned missile

In vanilla, spawned aircraft always target the cell under the target unit, not the unit itself. Although it is possible to use a series of tricks like MissileSpawn=no (refer to the Traceable spawned missile implemented by 紫色放逐 in the YR+Ares environment article in the #References section), this comes with many costs. In Kratos, this has been directly allowed.

[SOMEAIRCRAFT]                   ; AircraftType
Missile.Homing=no                 ; boolean

Whether to enable spawned aircraft tracking. When the target of the spawned aircraft is an air unit, it will automatically enable. If the tracked target dies or becomes invisible, the spawned aircraft will still proceed to the last recorded destination and then explode.

Particularly important is that with this function enabled, the traceable spawned missile can, after entering the descent phase, re-lift to horizontal flight altitude due to the target being too far away!

Bugs/Side-Effects/Unexpected Limitations

Buildings were able to use Spawns logic only as long as the spawned AircraftType was not listed in V3RocketType= or DMislType= or CMislType=, thus could only spawn aircraft like the Destroyer and the Aircraft Carrier. If a building were to spawn a missile, the game would crash.

  • This bug has been fixed in Ares 1.0.

References

See Also