Skip to content

[General Purpose] New trajectory system #1582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 54 commits into
base: develop
Choose a base branch
from

Conversation

CrimRecya
Copy link
Contributor

@CrimRecya CrimRecya commented Mar 20, 2025

Projectile trajectories

  • Projectiles can now have customizable trajectories.
    • Trajectory should not be combined with original game's projectile trajectory logics (Arcing, ROT, Vertical or Inviso). Attempt to do so will result in the other logics being disabled and a warning being written to log file. It also has linkage functions with Inaccurate, BallisticScatter.Min, BallisticScatter.Max, Gravity, SubjectToGround.
    • Trajectory.Speed defines the speed of the projectile, which unlike Speed used by ROT > 0 projectiles is defined on projectile not weapon.
      • In Trajectory=Straight, it refers to the whole distance speed of the projectile.
      • In Trajectory=Bombard, it refers to the initial speed of the projectile.
      • In Trajectory=Missile, it refers to the final speed of the projectile. Trajectory.Speed will be fixed at 192 by setting Trajectory.Missile.UniqueCurve=true.
      • In Trajectory=Engrave, it refers to the horizontal engrave speed of the projectile and it cannot exceed 128. Recommend set as about 40.
      • In Trajectory=Parabola, it refers to the horizontal velocity of the projectile and is only used for modes 0, 3, or 5.
      • In Trajectory=Tracing, it refers to the moving speed of the projectile.
    • Trajectory.Duration controls the duration the projectile can exist, and at the end of the time, the projectile will detonate. If it is a non positive number, there will be no timing.
      • In Trajectory=Engrave, if it is a non positive number, automatically use Trajectory.Engrave.SourceCoord and Trajectory.Engrave.TargetCoord to calculate the process duration. At this point, Trajectory.Engrave.TargetCoord can be regarded as the endpoint coordinates of the cutting line segment.
      • In Trajectory=Tracing, if set to zero, use weapon's ROF-10 as the duration. At least 1 frame. If it is negative, do not time it.
    • Trajectory.TolerantTime controls how long the projectile will detonate after losing the target. If it is 0, it will detonate directly when switching targets.
    • Trajectory.CreateCapacity controls the capacity that this type of trajectory projectile can be fired. When it is set to a non negative number, the trajectory projectile can only be fired when number of this trajectory type fired by the firer on the map is less than this value.
    • Trajectory.BulletROT controls the rotational speed of the projectile. When it is 0, it will always face the direction defined by Trajectory.BulletFacing. Otherwise, it will rotate towards the target according to this speed.
    • Trajectory.BulletFacing controls what direction the projectile should face. This has the following 7 modes.
      • Velocity - Following the direction of velocity. Towards the direction of motion of the projectile. If Trajectory.BulletROT is negative, it will only rotate on the horizontal plane.
      • Spin - Continuous self rotation. Continuously rotating on a horizontal plane. The positive and negative of Trajectory.BulletROT can control the direction.
      • Stable - Static after launch. No longer rotates towards the direction after launch. If Trajectory.BulletROT is negative, only the direction on the horizontal plane exists.
      • Target - Follow the direction of the target. Towards the direction of the projectile target unit. If Trajectory.BulletROT is negative, it will only rotate on the horizontal plane.
      • Destination - Follow the direction of the destination. Towards the direction of the projectile destination. If Trajectory.BulletROT is negative, it will only rotate on the horizontal plane.
      • FirerBody - Follow the direction of the launcher's body. Follow the orientation of the firer's body, and remain still after the launcher is killed. Only rotates on a horizontal plane.
      • FirerTurret - Follow the orientation of the launcher turret. Follow the orientation of the firer's turret, and remain still after the launcher is killed. Only rotates on a horizontal plane.
    • Trajectory.RetargetRadius controls the radius of the projectile to search for a new target after losing its original target. The projectile will search for new target at the original target's location.
      • In Trajectory=Missile, if the projectile hasn't arrived Trajectory.Missile.PreAimCoord yet, the last coordinate of the original target is taken as the center of the searching circle. Otherwise, the coordinate of the distance in front of the projectile is taken as the center of the circle. Set to 0 indicates that this function is not enabled, and it will still attempt to attack the original target's location. If it is set to a negative value, it will directly self explode in place.
      • In Trajectory=Tracing, the projectile will search for new target at the current position of itself.
      • Trajectory.RetargetInterval controls how long it takes to search for new target each time it is searched again.
      • Trajectory.RetargetHouses controls the projectile can find new target from which houses.
    • Trajectory.Synchronize controls whether the target of the projectile is synchronized with the target of its firer. If not, the projectile will not update the target.
    • Trajectory.PeacefulVanish controls whether the projectile disappears directly when it is about to detonate, without producing animation or causing damage. The default value is Trajectory=Engrave or Trajectory.ProximityImpact not equal to 0 or Trajectory.DisperseCycle not equal to 0.
    • Trajectory.ApplyRangeModifiers controls whether any applicable weapon range modifiers from the firer are applied to the projectile.
    • Trajectory.UseDisperseCoord controls whether the fire position need to replaced with the FLH of its superior's trajectory, which set Trajectory.RecordSourceCoord to true (Only if the weapon should be fired from the unit position).
    • Trajectory.RecordSourceCoord controls whether the projectile needs to record the launch position, which will be used for the weapons in Trajectory.DisperseWeapons. It can be nested and inherited. The default value is Trajectory=Engrave or have set Trajectory.DisperseWeapons.
      • In Trajectory=Engrave, it will also be used as a starting point for laser drawing.
    • Trajectory.OffsetCoord controls the offsets of the target. Projectile will aim at this position to attack. It also supports Inaccurate and Trajectory.LeadTimeCalculate on this basis.
      • In Trajectory=Engrave or Trajectory=Tracing, these are invalid.
      • Trajectory.RotateCoord controls whether to rotate the projectile's firing direction within the angle bisector of Trajectory.OffsetCoord (or Trajectory.Missile.PreAimCoord in Trajectory=Missile) according to the most superior's weapon's Burst. Set to 0 to disable this function.
      • Trajectory.MirrorCoord controls whether Trajectory.OffsetCoord need to mirror the lateral value to adapt to the current burst index. At the same time, the rotation direction calculated by Trajectory.RotateCoord will also be reversed, and the rotation angle between each adjacent projectile on each side will not change as a result.
      • Trajectory.AxisOfRotation controls the rotation axis when calculating Trajectory.RotateCoord. The axis will rotates with the unit orientation or the vector that from target position to the source position.
    • Trajectory.LeadTimeCalculate controls whether the projectile need to calculate the lead time of the target when firing. Note that this will not affect the facing of the turret.
    • Trajectory.DetonationDistance controls the maximum distance in cells from intended target at which the projectile will be forced to detonate. Set to 0 to disable forced detonation.
      • In Trajectory=Straight, if Trajectory.ApplyRangeModifiers is set to true, any applicable weapon range modifiers from the firer are applied here as well. By setting Trajectory.Straight.PassThrough=true, it refers to the distance that projectile should travel from itself when it above 0, and the distance that projectile should move behind the target when it below 0 (use the absolute value).
      • In Trajectory=Bombard, when it is set to a negative value, if the target is movable, it will change its target to the cell where the target is located (This is a function expanded for Missile and Airburst purposes).
      • In Trajectory=Missile, just detonate according to the conditions.
      • In Trajectory=Parabola, when it is set to a negative value, if the target is movable, it will change its target to the cell where the target is located (This is a function expanded for Missile and Airburst purposes).
    • Trajectory.TargetSnapDistance controls the maximum distance in cells from intended target the projectile can be at moment of detonation to make the projectile 'snap' on the intended target. Set to 0 to disable snapping.
    • Trajectory.DetonationHeight controls when the projectile is in a descending state and below the height of the launch position plus this value, it will detonate prematurely. Taking effect when it is set to non negative value. If Trajectory.EarlyDetonation is set to true, it'll take effect during the ascending stage instead, which makes it detonate when its height is above the launch position plus this value.
      • Only in Trajectory=Bombard or Trajectory=Parabola, these are valid.
    • Trajectory.AllowFirerTurning controls whether the projectile allow for significant changes in the orientation of the firer, otherwise it will disappear.

In rulesmd.ini:

[SOMEPROJECTILE]                      ; Projectile
Trajectory=                           ; Trajectory type enumeration (Straight|Bombard|Missile|Engrave|Parabola|Tracing)
Trajectory.Speed=100.0                ; floating point value
Trajectory.Duration=0                 ; integer
Trajectory.TolerantTime=-1            ; integer
Trajectory.CreateCapacity=-1          ; integer
Trajectory.BulletROT=0                ; integer
Trajectory.BulletFacing=velocity      ; Bullet facing enumeration (Velocity|Spin|Stable|Target|Destination|FirerBody|FirerTurret)
Trajectory.RetargetRadius=0           ; floating point value
Trajectory.RetargetInterval=1         ; integer
Trajectory.RetargetHouses=enemies     ; List of Affected House Enumeration (none|owner/self|allies/ally|team|enemies/enemy|all)
Trajectory.Synchronize=false          ; boolean
Trajectory.PeacefulVanish=            ; boolean
Trajectory.ApplyRangeModifiers=false  ; boolean
Trajectory.UseDisperseCoord=false     ; boolean
Trajectory.RecordSourceCoord=         ; boolean
Trajectory.OffsetCoord=0,0,0          ; integer - Forward,Lateral,Height
Trajectory.RotateCoord=0              ; floating point value
Trajectory.MirrorCoord=true           ; boolean
Trajectory.AxisOfRotation=0,0,1       ; integer - Forward,Lateral,Height
Trajectory.LeadTimeCalculate=false    ; boolean
Trajectory.DetonationDistance=0.4     ; floating point value
Trajectory.TargetSnapDistance=0.5     ; floating point value
Trajectory.EarlyDetonation=false      ; boolean
Trajectory.DetonationHeight=-1        ; integer
Trajectory.AllowFirerTurning=true     ; boolean
- Make sure you set a low `Trajectory.RetargetRadius` value unless necessary.
  • The following table will briefly display the support of various types for various general functions. (⚪ - effective / · - invalid)
Key Straight Bombard Missile Engrave Parabola Tracing
Inaccurate · ·
BallisticScatter · ·
Gravity · · ·
SubjectToGround · · · ·
ProjectileRange(Weapon's) · ·
Trajectory.Speed
Trajectory.Duration
Trajectory.TolerantTime
Trajectory.CreateCapacity
Trajectory.BulletROT
Trajectory.BulletFacing
Trajectory.RetargetRadius
Trajectory.Synchronize
Trajectory.PeacefulVanish
Trajectory.ApplyRangeModifiers
Trajectory.UseDisperseCoord
Trajectory.RecordSourceCoord
Trajectory.OffsetCoord · ·
Trajectory.RotateCoord · ·
Trajectory.MirrorCoord
Trajectory.AxisOfRotation · ·
Trajectory.LeadTimeCalculate · ·
Trajectory.DetonationDistance · ·
Trajectory.TargetSnapDistance · ·
Trajectory.EarlyDetonation · · · ·
Trajectory.DetonationHeight · · · ·
Trajectory.AllowFirerTurning · · · ·
- `SubjectToGround` can cause the projectile with `Trajectory=Straight` during the entire process or the projectile with `Trajectory=Bombard` during the ascent phase to detonate prematurely due to impact with the ground.
- Setting `Trajectory.Missile.UniqueCurve` will ignore all of these settings.
  • In addition, these types of projectile also have some general functions for detonating warheads. Effective for all types.
    • Trajectory.PassDetonate enables extra detonations when the projectile is traveling. (You can use this when you want the projectile to detonate warheads every other distance/time during the flight.)
      • Trajectory.PassDetonateWarhead defines the warhead detonated by Trajectory.PassDetonate. If not set, use the original warhead of the projectile.
      • Trajectory.PassDetonateDamage defines the damage caused by Trajectory.PassDetonateWarhead. If not set, use the original damage of the projectile.
      • Trajectory.PassDetonateDelay controls the delay for detonating the warhead defined by Trajectory.PassDetonateWarhead.
      • Trajectory.PassDetonateInitialDelay controls the initial delay for detonating the warhead defined by Trajectory.PassDetonateWarhead.
      • Trajectory.PassDetonateLocal controls whether Trajectory.PassDetonateWarhead and weapon's Warhead are always detonate at ground level.
    • Trajectory.ProximityImpact controls the initial proximity fuse times. When there are enough remaining times and the projectile approaches another valid target, it will detonate a warhead defined by Trajectory.ProximityWarhead on it. If the times is about to run out, it will also detonate itself at its location. This function can be cancelled by setting to 0. A negative integer means unlimited times. By the way, you can use the weapon's Warhead with low versus only to aim at the target, and use the Trajectory.ProximityWarhead to causing actual harm. (You can use this to cause non repeated damage to all units encountered during the flight of the projectile.)
      • Trajectory.ProximityWarhead defines the warhead detonated by Trajectory.ProximityImpact. If not set, use the original warhead of the projectile.
      • Trajectory.ProximityDamage defines the damage caused by Trajectory.ProximityWarhead. If not set, use the original damage of the projectile.
      • Trajectory.ProximityRadius controls the range of proximity fuse. It can NOT be set as a negative integer.
      • Trajectory.ProximityDirect controls whether let the target receive damage instead of detonating the warhead.
      • Trajectory.ProximityMedial controls whether to detonate Trajectory.ProximityWarhead at the bullet's location rather than the proximity target's location. If Trajectory.ProximityDirect is set to true, this will only affect the calculation result of Trajectory.DamageEdgeAttenuation.
      • Trajectory.ProximityAllies controls whether allies will also trigger the proximity fuse.
      • Trajectory.ProximityFlight controls whether to count units in the air.
    • Trajectory.ThroughVehicles controls whether the projectile will not be obstructed by vehicles or aircrafts on the ground. When it is obstructed, it will be directly detonated at its location. If it still have Trajectory.ProximityImpact times, it will also detonate a Trajectory.ProximityImpact at the location of the obstacle. Before the projectile being blocked, Trajectory.ProximityImpact will also not cause damage to vehicles or aircrafts.
    • Trajectory.ThroughBuilding controls whether the projectile will not be obstructed by buildings. When it is obstructed, it will be directly detonated at its location. If it still have Trajectory.ProximityImpact times, it will also detonate a Trajectory.ProximityImpact at the location of the obstacle. Before the projectile being blocked, Trajectory.ProximityImpact will also not cause damage to buildings.
    • Trajectory.DamageEdgeAttenuation controls the edge attenuation ratio of projectile damage (includes all types of the trajectory's damage), that is, the actual damage caused will be this value multiplied by the ratio of the current distance to the weapon's range. Can NOT be set to a negative integer.
    • Trajectory.DamageCountAttenuation controls the attenuation coefficient of projectile damage (includes all types of the trajectory's damage), that is, how many times the next damage after each bounce is the damage just caused. Can NOT be set to a negative integer.

In rulesmd.ini:

[SOMEPROJECTILE]                       ; Projectile
Trajectory.PassDetonate=false          ; boolean
Trajectory.PassDetonateWarhead=        ; WarheadType
Trajectory.PassDetonateDamage=         ; integer
Trajectory.PassDetonateDelay=1         ; integer
Trajectory.PassDetonateInitialDelay=0  ; integer
Trajectory.PassDetonateLocal=false     ; boolean
Trajectory.ProximityImpact=0           ; integer
Trajectory.ProximityWarhead=           ; WarheadType
Trajectory.ProximityDamage=            ; integer
Trajectory.ProximityRadius=0.7         ; floating point value
Trajectory.ProximityDirect=false       ; boolean
Trajectory.ProximityMedial=false       ; boolean
Trajectory.ProximityAllies=false       ; boolean
Trajectory.ProximityFlight=false       ; boolean
Trajectory.ThroughVehicles=true        ; boolean
Trajectory.ThroughBuilding=true        ; boolean
Trajectory.DamageEdgeAttenuation=1.0   ; floating point value
Trajectory.DamageCountAttenuation=1.0  ; floating point value
- The listed Warheads in `Trajectory.PassDetonateWarhead` and `Trajectory.ProximityWarhead` must be listed in `[Warheads]` for them to work.
- Make sure you set a low `Trajectory.ProximityRadius` value unless necessary.
- `SubjectToBuildings` and `Trajectory.ThroughBuilding` are different. But the two are not in conflict and can take effect simultaneously. The former can affect the search for enemies and ignore the main target, follows the settings of Ares and will only self destruct when conditions are met. While the latter will self destruct when touching only non-allies building (including main target) and trigger its effect if `Trajectory.ProximityImpact` is set.
- Simply put, `Trajectory.PassDetonate` is periodically effect and `Trajectory.ProximityImpact` is once per person effect.
- If `Trajectory.ProximityImpact` is set to non-zero, the default value of `Trajectory.PeacefulVanish` will be changed.
  • Of course, there are also some general functions for launching weapons. Effective for all types too.
    • Trajectory.DisperseWeapons defines the dispersal weapons of the projectile.
    • Trajectory.DisperseBursts defines how many corresponding weapons each time the projectile will fire. When the quantity is lower than Trajectory.DisperseWeapons, the last value in the list will be used.
    • Trajectory.DisperseCounts controls how many times the projectile can fire the weapon. Set to a negative value means unlimited times. If set to zero, the cooling will be calculated directly without firing the weapon. If the quantity is less than the number of firing groups, the last value in the list will be used.
    • Trajectory.DisperseDelays controls the interval delays for dispersing the weapons. If the quantity is less than the number of firing groups, the last value in the list will be used.
    • Trajectory.DisperseCycle controls how many rounds of weapons the projectile can fire, zero will not fire weapons, and negative numbers are considered infinite.
    • Trajectory.DisperseInitialDelay controls the initial delay for dispersing the weapons defined by Trajectory.DisperseWeapons.
    • Trajectory.DisperseEffectiveRange controls the weapon dispersing timer to start counting only within this distance of reaching the target. Set to 0 to disable this function. Set to a negative value means it will only Disperse the weapon at most once before detonation.
    • Trajectory.DisperseSeparate controls whether the projectile no longer fire all the weapons in Trajectory.DisperseWeapons at once and instead fire a group of weapons in the list order, following Trajectory.DisperseBursts. And control how to calculate the number of firing groups. In short, if true, group the weapons and fire them the corresponding counts of times in Trajectory.DisperseWeapons order. Otherwise, fire all weapons simultaneously and fire sequentially in Trajectory.DisperseCounts order.
    • Trajectory.DisperseRetarget controls whether the Disperse weapons will find new targets on their own. Using the Range, CanTarget, CanTargetHouses, required AttachedEffects of weapons to search new targets.
    • Trajectory.DisperseLocation controls whether the Disperse weapons will search for new targets at the center of the spreading position, otherwise they will focus on the original target.
    • Trajectory.DisperseTendency controls whether the Disperse weapons will choose the original target as the first new target in each group of weapons.
    • Trajectory.DisperseHolistic controls whether the Disperse weapons will choose targets that are in different states from the original target (in air and on ground).
    • Trajectory.DisperseMarginal controls whether the Disperse weapons will choose unimportant items such as trees (regard as on ground), streetlights (regard as on ground) or bullets (regard as in air) as secondary targets.
    • Trajectory.DisperseDoRepeat controls whether the Disperse weapons will select duplicate targets when the number of targets is insufficient. If it is set to true and the weapon can select both the technos and the ground as targets, the technos will be prioritized, then if all non-repeating technos have been selected and the weapon can still be launched at this time (in each round of salvo), it will start selecting duplicate technos. If it is set to false and the weapon can select both the technos and the ground as targets, the technos will be prioritized, followed by the ground cells, then if all non-repeating technos have been selected and the weapon can still be launched at this time (in each round of salvo), it will stop firing remaining bursts.
    • Trajectory.DisperseSuicide controls whether the projectile will self destruct after the number of times it spreads the weapon has been exhausted.
    • Trajectory.DisperseFromFirer controls whether the weapons will be fired by the firer towards the projectile. Otherwise, the tracing weapons will be fired from the projectile towards the target. Using different default values, when Trajectory=Engrave or Trajectory=Tracing, the default is true, while others are false.
    • Trajectory.DisperseFaceCheck controls whether the projectile will check its orientation before firing the weapons. Ignore this if Trajectory.BulletFacing=Velocity or Trajectory.BulletFacing=Spin.
    • Trajectory.DisperseForceFire controls whether still fire disperse weapon when the projectile itself has no target or the target is beyond the weapon's range.
    • Trajectory.DisperseCoord controls the FLH where the projectile fires the weapon when set Trajectory.DisperseFromFirer to false.

In rulesmd.ini:

[SOMEPROJECTILE]                     ; Projectile
Trajectory.DisperseWeapons=          ; list of WeaponTypes
Trajectory.DisperseBursts=           ; list of integers
Trajectory.DisperseCounts=           ; list of integers
Trajectory.DisperseDelays=           ; list of integers
Trajectory.DisperseCycle=0           ; integer
Trajectory.DisperseInitialDelay=0    ; integer
Trajectory.DisperseEffectiveRange=0  ; floating point value
Trajectory.DisperseSeparate=false    ; boolean
Trajectory.DisperseRetarget=false    ; boolean
Trajectory.DisperseLocation=false    ; boolean
Trajectory.DisperseTendency=false    ; boolean
Trajectory.DisperseHolistic=false    ; boolean
Trajectory.DisperseMarginal=false    ; boolean
Trajectory.DisperseDoRepeat=false    ; boolean
Trajectory.DisperseSuicide=true      ; boolean
Trajectory.DisperseFromFirer=        ; boolean
Trajectory.DisperseFaceCheck=false   ; boolean
Trajectory.DisperseForceFire=true    ; boolean
Trajectory.DisperseCoord=0,0,0       ; integer - Forward,Lateral,Height
- The listed Weapons in `Trajectory.DisperseWeapons` must be listed in `[WeaponTypes]` for them to work.
- If you set `Trajectory.DisperseRetarget=true`, also make sure you set `Trajectory.DisperseWeapons` a low `Range` value unless necessary.
- `Trajectory.DisperseWeapons` now not support `Arcing=true` projectiles and customized `Bolt.ColorN`.
- Although `Trajectory.DisperseDoRepeat=false` will disable duplicate target selection, if the weapon is able to attack the ground, it may still attack duplicate targets by locking onto the cell where the target is located.
- If `Trajectory.DisperseCycle` is set to non-zero, the default value of `Trajectory.PeacefulVanish` will be changed.

Straight trajectory

  • Self-explanatory, is a straight-shot trajectory.
    • Trajectory.Straight.PassThrough enables special case logic where the projectile does not detonate in contact with the target but instead travels up to a distance defined by Trajectory.DetonationDistance. Note that the firing angle of the projectile is adjusted with this in mind, making it fire straight ahead if the target is on same elevation.
    • Trajectory.Straight.ConfineAtHeight controls the height above ground that projectile will try to travel as it can. It can not move down from the cliff by setting SubjectToCliffs to true. It can be cancelled by setting as a non positive integer. It will be forcibly cancelled by setting Trajectory.Speed above 256. If Trajectory.PassDetonateLocal is set to true at the same time, the vertical speed will not be limited.

In rulesmd.ini:

[SOMEPROJECTILE]                       ; Projectile
Trajectory.Straight.PassThrough=false  ; boolean
Trajectory.Straight.ConfineAtHeight=0  ; integer

Bombard trajectory

  • Similar trajectory to Straight, but targets a coordinate between the attacker and intended target first. When the projectile approaches that turning point, it'll turn to the intended target and explodes when it hits the target or ground.
    • Trajectory.Bombard.Height controls the height of the turning point.
    • Trajectory.Bombard.FallPercent controls the distance of the turning point by its percentage of the total distance between attacker and intended target. If set to 0%, then it'll fly up vertically. If set to 100%, then it'll travel to the top of the intended target.
      • For each launch the turning point percentage could add or minus a random value, which is not greater than Trajectory.Bombard.FallPercentShift. If set to 0%, random shift will be disabled.
      • You can also makes the turning point scatter randomly in a circle with Trajectory.Bombard.FallScatter.Max as its radius. If set to 0, random scatter will be disabled. Trajectory.Bombard.FallScatter.Min can be used to determine the minimum radius of the circle. If Trajectory.Bombard.FallScatter.Linear set to true, the random scatter will be limited to the line that is vertical to the original direction of the projectile.
    • Trajectory.Bombard.FreeFallOnTarget controls how it'll hit the intended target. If set to true, the projectile will be respawned above the intended target and free fall. If set to false, the projectile will travel to the intended target from the turning point.
    • Trajectory.Bombard.NoLaunch controls whether the attacker will fire the projectile by itself. If set to true, projectile will directly fall from the turning point.
    • Trajectory.Bombard.FallSpeed controls the initial speed of the projectile after it turns. If set to 0.0, then it'll use Trajectory.Speed. Can't work when Trajectory.Bombard.FreeFallOnTarget set to true.
    • Trajectory.Bombard.TurningPointAnims, if set, will play an anim when the projectile reaches the turning point. If Trajectory.Bombard.FreeFallOnTarget is set to true, it'll be spawned above the target with the projectile together. If Trajectory.Bombard.NoLaunch is set to true, it'll be played at where the projectile falls, no matter if it's free fall or not. If more than one animation is listed, a random one is selected.

In rulesmd.ini:

[SOMEPROJECTILE]                             ; Projectile
Trajectory.Bombard.Height=0.0                ; floating point value
Trajectory.Bombard.FallPercent=1.0           ; floating point value
Trajectory.Bombard.FallPercentShift=0.0      ; floating point value
Trajectory.Bombard.FallScatter.Max=0.0       ; floating point value
Trajectory.Bombard.FallScatter.Min=0.0       ; floating point value
Trajectory.Bombard.FallScatter.Linear=false  ; boolean
Trajectory.Bombard.FreeFallOnTarget=true     ; boolean
Trajectory.Bombard.NoLaunch=false            ; boolean
Trajectory.Bombard.FallSpeed=0.0             ; floating point value
Trajectory.Bombard.TurningPointAnims=        ; List of AnimationTypes

Missile trajectory

  • Its trajectory looks a bit like a ROT, but its settings are more flexible. It also has a unique trajectory.
    • Trajectory.Missile.UniqueCurve controls whether to enable simulated Qian Xuesen trajectory. After enabling this, it will NOT respect the other items.
    • Trajectory.Missile.PreAimCoord controls the initial flight direction of the projectile, and after reaching this coordinate, it will begin to turn towards the target direction. When it is set to 0,0,0 , it will directly face the target.
      • Trajectory.Missile.FacingCoord controls whether the forward direction in Trajectory.Missile.PreAimCoord is depending on the orientation of the firer. By default, it will depend on the vector between the firer and the target.
      • Trajectory.Missile.ReduceCoord controls whether Trajectory.Missile.PreAimCoord defines the initial movement coordinates when the attack distance is 10 cells, and the actual initial movement coordinates will change with the length of the attack distance. It can be simply understood as an optimization term aimed at ensuring hits at close range.
    • Trajectory.Missile.LaunchSpeed controls the initial flight speed of the projectile.
      • Trajectory.Missile.Acceleration controls the acceleration of the projectile's flight speed, increasing or decreasing the speed per frame according to this value, the final speed will be Trajectory.Speed.
      • Trajectory.Missile.TurningSpeed controls the turning speed of the projectile which refers to the maximum angle that the projectile can rotate per frame in terms of direction.
    • Trajectory.Missile.LockDirection controls whether after reaching Trajectory.Missile.PreAimCoord and completing the first turn, the projectile will lock the direction of motion without further adjustment.
    • Trajectory.Missile.CruiseEnable controls whether after reaching Trajectory.Missile.PreAimCoord and completing the first turn, the projectile will maintain altitude while moving towards the target.
      • Trajectory.Missile.CruiseUnableRange controls how far away it is from the target to end the cruise phase, no longer maintaining the cruise altitude, and begins to move directly towards the target. If the distance is already below this value by the time Trajectory.Missile.PreAimCoord is reached, the cruise phase will be skipped.
      • Trajectory.Missile.CruiseAltitude controls the minimum altitude of the projectile in the cruise phase.
      • Trajectory.Missile.CruiseAlongLevel controls whether to calculate Trajectory.Missile.CruiseAltitude by the height of the projectile and the ground height of the current position, otherwise it will be calculated by the height of the projectile and the height of the launch position.
    • Trajectory.Missile.SuicideAboveRange controls the projectile to self destruct directly after reaching the flight distance. Set to 0 to disable suicide. When set to a negative number, its absolute value represents a multiple of the initial distance.
    • Trajectory.Missile.SuicideShortOfROT controls whether the projectile will explode when it detected its insufficient turning ability.

In rulesmd.ini:

Trajectory.Missile.UniqueCurve=false        ; boolean
Trajectory.Missile.PreAimCoord=0,0,0        ; integer - Forward,Lateral,Height
Trajectory.Missile.FacingCoord=false        ; boolean
Trajectory.Missile.ReduceCoord=true         ; boolean
Trajectory.Missile.LaunchSpeed=0            ; floating point value
Trajectory.Missile.Acceleration=10.0        ; floating point value
Trajectory.Missile.TurningSpeed=10.0        ; floating point value
Trajectory.Missile.LockDirection=false      ; boolean
Trajectory.Missile.CruiseEnable=false       ; boolean
Trajectory.Missile.CruiseUnableRange=5.0    ; floating point value
Trajectory.Missile.CruiseAltitude=800       ; integer
Trajectory.Missile.CruiseAlongLevel=false   ; boolean
Trajectory.Missile.SuicideAboveRange=-3.0   ; floating point value
Trajectory.Missile.SuicideShortOfROT=false  ; boolean

Engrave trajectory

  • Visually, like the thermal lance. Calling it 'trajectory' may not be appropriate. It does not read the settings on the weapon.
    • Trajectory.Engrave.SourceCoord controls the starting point of engraving line segment. Taking the target as the coordinate center. Specifically, it will start from the firing position when set to 0,0 . The height of the point will always at ground level, unless the target is in the air.
    • Trajectory.Engrave.TargetCoord controls the end point of engraving line segment. If Trajectory.Duration is set to a positive number, it is only used for direction calculation. Taking the target as the coordinate center. The height of the point will always at ground level, unless the target is in the air.
    • Trajectory.Engrave.IsLaser controls whether laser drawing is required.
      • Trajectory.Engrave.IsIntense controls whether the engrave laser will be brighter and thicker. Need to set Trajectory.Engrave.IsHouseColor or Trajectory.Engrave.IsSingleColor to true.
      • Trajectory.Engrave.IsHouseColor controls whether set the engrave laser to draw using player's team color. These lasers respect Trajectory.Engrave.LaserThickness and Trajectory.Engrave.IsIntense.
      • Trajectory.Engrave.IsSingleColor controls whether set the engrave laser to draw using only Trajectory.Engrave.LaserInnerColor. These lasers respect Trajectory.Engrave.LaserThickness and Trajectory.Engrave.IsIntense.
      • Trajectory.Engrave.LaserInnerColor controls the inner color of the engrave laser.
      • Trajectory.Engrave.LaserOuterColor controls the outer color of the engrave laser.
      • Trajectory.Engrave.LaserOuterSpread controls the spread color of the engrave laser.
      • Trajectory.Engrave.LaserThickness controls the thickness of the engrave laser. Need to set Trajectory.Engrave.IsHouseColor or Trajectory.Engrave.IsSingleColor to true.
      • Trajectory.Engrave.LaserDuration controls the duration of the engrave laser.
      • Trajectory.Engrave.LaserDelay controls how often to draw the engrave laser.
    • Trajectory.Engrave.AttachToTarget controls whether the center position of the engrave laser will update with the target position.
    • Trajectory.Engrave.UpdateDirection controls whether the engrave laser updates the direction with the firer and target position.

In rulesmd.ini:

Trajectory.Engrave.SourceCoord=0,0         ; integer - Forward,Lateral
Trajectory.Engrave.TargetCoord=0,0         ; integer - Forward,Lateral
Trajectory.Engrave.IsLaser=true            ; boolean
Trajectory.Engrave.IsIntense=false         ; boolean
Trajectory.Engrave.IsHouseColor=false      ; boolean
Trajectory.Engrave.IsSingleColor=false     ; boolean
Trajectory.Engrave.LaserInnerColor=0,0,0   ; integer - Red,Green,Blue
Trajectory.Engrave.LaserOuterColor=0,0,0   ; integer - Red,Green,Blue
Trajectory.Engrave.LaserOuterSpread=0,0,0  ; integer - Red,Green,Blue
Trajectory.Engrave.LaserThickness=3        ; integer
Trajectory.Engrave.LaserDuration=1         ; integer
Trajectory.Engrave.LaserDelay=1            ; integer
Trajectory.Engrave.AttachToTarget=false    ; boolean
Trajectory.Engrave.UpdateDirection=false   ; boolean
- It's best not to let it be intercepted.
- Directly using the laser drawing in `Trajectory=Engrave` with `Trajectory.PassDetonateWarhead` is more cost-effective than using `Trajectory.DisperseWeapons`. If you need the laser to be blocked by the Fire Storm Wall, you can try using the latter.
- The default value of `Trajectory.PeacefulVanish` will be changed when using this type of trajectory.

Parabola trajectory

  • As the name says, this is a completely reset Arcing with different enhanced functions.
    • Trajectory.Parabola.OpenFireMode controls how should the projectile be launched. This has the following 6 modes.
      • Speed - Automatic calculation mode with fixed horizontal velocity, using Trajectory.Speed and target coordinates as calculation conditions, i.e. the flight time of the projectile is permanently fixed.
      • Height - Automatic calculation mode with fixed maximum height, useing Trajectory.Parabola.ThrowHeight and target coordinates as calculation conditions, i.e. the detonation time of the projectile is relatively fixed.
      • Angle - Automatic calculation mode with fixed fire angle, useing Trajectory.Parabola.LaunchAngle and target coordinates as calculation conditions. In this mode, the performance consumption is high, and may have no solution. It is not recommended to enable SubjectToCliffs or enable AA with a smaller MinimumRange when using this mode.
      • SpeedAndHeight - Fixed horizontal velocity and maximum height mode, using Trajectory.Speed and Trajectory.Parabola.ThrowHeight as calculation conditions, i.e. the trajectory will only undergo altitude changes with the height of the target.
      • HeightAndAngle - Fixed maximum height and fire angle mode, using Trajectory.Parabola.ThrowHeight and Trajectory.Parabola.LaunchAngle as calculation conditions, i.e. the trajectory will change horizontally with the height of the target.
      • SpeedAndAngle - Fixed horizontal velocity and fire angle mode, using Trajectory.Speed and Trajectory.Parabola.LaunchAngle as calculation conditions, i.e. the trajectory will be permanently fixed.
    • Trajectory.Parabola.ThrowHeight controls the maximum height of the projectile and is only used for modes Height, SpeedAndHeight, or HeightAndAngle. The specific height will be determined by taking the larger of the launch height and the target height then increasing this value. Non positive numbers are not supported.
    • Trajectory.Parabola.LaunchAngle controls the fire angle of the projectile and is only used for modes Angle, HeightAndAngle, or SpeedAndAngle. Only supports -90.0 ~ 90.0 (Cannot use boundary values) in Mode Angle or SpeedAndAngle, and 0.0 ~ 90.0 (Cannot use boundary values) in Mode HeightAndAngle.
    • Trajectory.Parabola.DetonationAngle controls when the angle between the projectile in the current velocity direction and the horizontal plane is less than this value, it will detonate prematurely. Taking effect when the value is at -90.0 ~ 90.0 (Cannot use boundary values).
    • Trajectory.Parabola.BounceTimes controls how many times can it bounce back when the projectile hits the ground or cliff. Be aware that excessive projectile speed may cause abnormal operation. And Trajectory.DetonationDistance do not conflict with this and will take effect simultaneously. So if you want to explode the bullet only after the times of bounces is exhausted, you should set Trajectory.DetonationDistance to a non positive value.
      • Trajectory.Parabola.BounceOnWater controls whether it can bounce on the water surface.
      • Trajectory.Parabola.BounceDetonate controls whether it detonates the warhead once extra during each bounce.
      • Trajectory.Parabola.BounceAttenuation controls the attenuation coefficient of projectile bounce damage, that is, how many times the next damage after each bounce is the damage just caused. This will also affect the damage of the final detonation.
      • Trajectory.Parabola.BounceCoefficient controls the attenuation coefficient of projectile bounce elasticity, that is, how many times the speed after each bounce is the speed before bouncing.

In rulesmd.ini:

Trajectory.Parabola.OpenFireMode=Speed     ; ParabolaFireMode value enumeration (Speed|Height|Angle|SpeedAndHeight|HeightAndAngle|SpeedAndAngle)
Trajectory.Parabola.ThrowHeight=600        ; integer
Trajectory.Parabola.LaunchAngle=30         ; floating point value
Trajectory.Parabola.DetonationAngle=-90.0  ; floating point value
Trajectory.Parabola.BounceTimes=0          ; integer
Trajectory.Parabola.BounceOnWater=false    ; boolean
Trajectory.Parabola.BounceDetonate=false   ; boolean
Trajectory.Parabola.BounceAttenuation=0.8  ; floating point value
Trajectory.Parabola.BounceCoefficient=0.8  ; floating point value
- If `Trajectory.Parabola.OpenFireMode=Angle`, the performance consumption is high, and may have no solution. It is not recommended to enable `SubjectToCliffs` or enable `AA` with a smaller `MinimumRange` when using this mode.
- Compared to vanilla `Arcing`, this can also be used for aircrafts and airburst weapon.
- Be aware that `Trajectory.DetonationDistance` do not conflict with `Trajectory.Parabola.BounceTimes` and will take effect simultaneously. So if you want to explode the bullet only after the times of bounces is exhausted, you should set `Trajectory.DetonationDistance` to a non positive value.

Tracing trajectory

  • A trajectory that can keep following the target and only detonate when its survival time is exhausted.
    • Trajectory.Tracing.TraceMode controls how should the projectile trace the target. This is used to calculate coordinate axis of Trajectory.Tracing.AttachCoord located on the tracking target. The H axis is not affected by the tilt and deflection of the tracking target, and always faces directly above. This has the following 6 modes.
      • Connection - Line vector. Take the horizontal component of the vector between the launch position and the target position as the F axis.
      • Global - Map direction. Take the lower right side of the map as the F axis.
      • Body - Follow the body. The F axis is the body orientation of the tracking target.
      • Turret - Follow the turret. The F axis is the turret orientation of the tracking target.
      • RotateCW - Rotate clockwise. Rotate clockwise around the H axis with the resultant offset in the FL direction as the radius.
      • RotateCCW - Rotate counterclockwise. Rotate counterclockwise around the H axis with the resultant offset in the FL direction as the radius.
    • Trajectory.Tracing.TraceTheTarget controls whether the target tracked by the projectile is the target of the projectile. Otherwise, it will trace the firer, and at the same time, the projectile will detonate if the firer dies.
    • Trajectory.Tracing.CreateAtTarget controls whether the projectile is directly generated at the target position.
    • Trajectory.Tracing.StableRotation controls whether the projectile will automatically rotate at the same angle interval when Trajectory.Tracing.TraceMode is RotateCW or RotateCCW. Need to cooperate with Trajectory.CreateCapacity records to take effect.
    • Trajectory.Tracing.CreateCoord controls the generate position. Not related to Trajectory.Tracing.TraceMode.
    • Trajectory.Tracing.AttachCoord controls the tracing position on its target, use Trajectory.Tracing.TraceMode determines the specific location.
    • Trajectory.Tracing.ChasableDistance controls the maximum distance between the target's center of the projectile pursuing and the firer's center. When it is a positive number, the distance will not exceed this value. When it is a negative number, if the distance exceeds this value, the projectile will explode. When it is zero, the weapon's range will be used and considered a positive number.

In rulesmd.ini:

Trajectory.Tracing.TraceMode=Connection  ; TraceMode value enumeration (Connection|Global|Body|Turret|RotateCW|RotateCCW)
Trajectory.Tracing.TraceTheTarget=true   ; boolean
Trajectory.Tracing.CreateAtTarget=false  ; boolean
Trajectory.Tracing.StableRotation=false  ; boolean
Trajectory.Tracing.CreateCoord=0,0,0     ; integer - Forward,Lateral,Height
Trajectory.Tracing.AttachCoord=0,0,0     ; integer - Forward,Lateral,Height
Trajectory.Tracing.ChasableDistance=0    ; floating point value

Copy link

github-actions bot commented Mar 20, 2025

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Coronia
Copy link
Contributor

Coronia commented Mar 20, 2025

Again, I would concern its backward compatibility. Since Straight, Bombard and Parabola are released logic, there might be modders using it already. Requiring them to modify existing codes is one thing, and those released mods and maps might even not have the chance to modify. I think the 'interface protocol', which means tags in the context of Phobos, should still be compatible when modifying existing functions

For trajectory, we can simply allow these existing 3 projectiles to read previous tags and overwrite the new variables. For example, if Trajectory.Straight.LeadTimeCalculate is already set for a straight trajectory, it should be used to overwrite Trajectory.LeadTimeCalculate. This would be an easy adjustment as we only need to add a few more ini parsing lines

e.g. in StraightTrajectory.cpp

this->LeadTimeCalculate.Read(exINI, pSection, "Trajectory.Straight.LeadTimeCalculate");

@mevitar
Copy link

mevitar commented Mar 20, 2025

I don't think we need to worry about backwards compatibility with this. Like, are there really that many mods that released between changes to Straight and now that aren't developed anymore?
And if they aren't developed, people should not switch to a newer Phobos.dll in the first place!

Everyone else can just update their code to fit the new logic. Just remember to note it in the What's New section (and i guess in the Migration Ulitity? not sure how that one even works, i never used it tbh).

@Metadorius
Copy link
Member

For most renames Migration Utility exists and is a valid option. It searches and replaces en masse using regex. Basically it's automated search and replace tool.

As such any simple tag renames should be put into the migration tool.

@Starkku
Copy link
Contributor

Starkku commented Mar 20, 2025

This PR is pretty much aiming to remove the sort of redundancy that having same value be parsed from multiple keys would add back so that's just not a good idea.

Breaking backwards compatibility is never ideal but it is acceptable in some cases with appropriate migration notice and additions to migration scripts. There will be people who are confused by the changes regardless, whether because they do not read the migration notices or something else, but this one corrects an issue that has potential to snowball into something bigger if even more trajectory types are added in future. In future any new additions that cover or have potential to apply to multiple trajectory types should follow same precedent.

@DeathFishAtEase
Copy link
Collaborator

Perhaps compatibility issues could be addressed through the key-value pair reading process, similar to how Ares' Ripple.Radius and IonCannon.Ripple handle it.

@Metadorius
Copy link
Member

Perhaps compatibility issues could be addressed through the key-value pair reading process, similar to how Ares' Ripple.Radius and IonCannon.Ripple handle it.

Why won't migration tool work?

@DeathFishAtEase
Copy link
Collaborator

DeathFishAtEase commented Mar 20, 2025

Why won't migration tool work?

I am considering the situation described by Starkku.

There will be people who are confused by the changes regardless, whether because they do not read the migration notices or something else


Perhaps compatibility issues could be addressed through the key-value pair reading process, similar to how Ares' Ripple.Radius and IonCannon.Ripple handle it.

However, this effectively reduces the workload for users to perform batch text modifications as well as the need to train users in PowerShell scripting.

@Metadorius
Copy link
Member

I am considering the situation described by Starkku.

There will be people who are confused by the changes regardless, whether because they do not read the migration notices or something else

I think the point was that there will be people like that no matter what you do, so there's no point in inventing something like that and the situation is fine.

@DeathFishAtEase
Copy link
Collaborator

there will be people like that no matter what you do

Well, you're right. :P

@CrimRecya
Copy link
Contributor Author

I mainly integrated functions that can be generalized and also created some new universal functions. Meanwhile, I used inheritance relationships to distinguish between two major categories of trajectories, they also have their own relatively independent functional differences. I have added a large number of comments and also updated the sample for creating new type in the future.
But since I don't have my own mod, I'm not quite sure how to present vivid GIFs in the doc in the most appropriate way. This is quite frustrating.

Regarding the key names, I also thought that there would be no need to add an extra paragraph for the parts that can be shared. A short name indicates its universality while avoiding overly lengthy names.
Actually, I have received some feedback that told me that when the trajectory type increases, the key names become quite lengthy, seems unnecessary because they only change in the middle.
At present, there are only three types that have been merged, and they were all just done in the previous version. I think it is not so complicated even manually replacing them with regular expressions like (Trajectory)(\.).+\.(Proximity.+=) -> $1$2$3.

@TaranDahl TaranDahl added ❓New feature ⚙️T2 T2 maintainer review is sufficient labels Mar 22, 2025
@Coronia Coronia added Needs testing Major Big stuff to do labels Mar 22, 2025
@mevitar
Copy link

mevitar commented Apr 11, 2025

If the primary target of Trajectory=Missile is killed and the projectile tries to retarget, it can acquire a friendly object that is nearby. I think there needs to be a way to specify which houses are eligible for retargeting (even a tag similar to Trajectory.ProximityAllies=yes/no will suffice).

@C-Zei
Copy link

C-Zei commented Apr 11, 2025

is it possible to add additional feature to Inaccurate/scatter against diffrent technotype
example : Generals Rocketbuggies, rocket has scatter against Infantry, Tiberian dawn tank, and.. GDI Orca ?

maybe something like
Trajectory.ScatterAgainst=Infantry,Building

@CrimRecya
Copy link
Contributor Author

If the primary target of Trajectory=Missile is killed and the projectile tries to retarget, it can acquire a friendly object that is nearby. I think there needs to be a way to specify which houses are eligible for retargeting (even a tag similar to Trajectory.ProximityAllies=yes/no will suffice).

Actually, it will follow CanTargetHouses . However, perhaps it should be defined separately. Thank you for your feedback.

@CrimRecya
Copy link
Contributor Author

is it possible to add additional feature to Inaccurate/scatter against diffrent technotype example : Generals Rocketbuggies, rocket has scatter against Infantry, Tiberian dawn tank, and.. GDI Orca ?

maybe something like Trajectory.ScatterAgainst=Infantry,Building

It's possible, but I'm wondering if this weapon is a bit strange?
Additionally, this can also be achieved by using two weapon slots.

@C-Zei
Copy link

C-Zei commented Apr 12, 2025

It's possible, but I'm wondering if this weapon is a bit strange? Additionally, this can also be achieved by using two weapon slots.

true, it can be achived by 2 slot. but i think it would made stuff like Occupy, isGatling more viable

its strange indeed but Company of Heroes use similiar system, ex AntiTank Weapon is still lethal against infantry if it hit, but their accuracy against infantry type is abysmall (though in CoH the equivalent would be weapon has spesificly defined acuracy against multiple class of entity - kinda like accuracy 100% vs tank, 1% vs inf ranger, 0,1% vs commando ) if weapon miss, it would scatter and might hit random object around target.

@mevitar
Copy link

mevitar commented Apr 12, 2025

Actually, it will follow CanTargetHouses . However, perhaps it should be defined separately. Thank you for your feedback.

The problem with CanTargetHouses= is that it is a weapon tag, and making it target only enemies means that the weapon cannot be force fired on allies anymore. That's why i think a separate tag to disable retargeting on allies is needed.

@mevitar
Copy link

mevitar commented Apr 20, 2025

In Trajectory=Tracing, the projectile will search for new target at the current position of **the** itself.
Gramatically incorrect line in the documentation, THE should be removed.

@mevitar
Copy link

mevitar commented Apr 25, 2025

I have a long-ranged missile weapon fired by an AirstrikeFlare-spawned AircraftType. The missile uses the following projectile code.

Inaccurate=yes
BallisticScatter.Min=0
BallisticScatter.Max=.75

Trajectory=Missile
Trajectory.Missile.CruiseEnable=yes
Trajectory.Missile.CruiseAltitude=900
Trajectory.Missile.CruiseUnableRange=16
Trajectory.Missile.LaunchSpeed=10
Trajectory.Missile.Acceleration=20
Trajectory.Missile.TurningSpeed=3
Trajectory.Missile.SuicideAboveRange=0
Trajectory.BulletROT=3
Trajectory.RetargetRadius=0
Trajectory.RetargetInterval=15
Trajectory.RetargetHouses=none
Trajectory.Speed=50

I assumed this will simply make it turn very slowly, but for some reason, it ignores the designated CruiseAltitude and hits the ground like 10 cells before the target. Sometimes i don't even see the projectile spawning, so it presumably kills itself on some other obstacle i don't see.

But if i set Trajectory.Missile.TurningSpeed=5 and Trajectory.BulletROT=5 (or anything above that), it works fine. I can see the projectile properly turning to reach its CruiseAltitude and flying torwards the target.

Is there some calculation error with very low values of Trajectory.Missile.TurningSpeed= and/or Trajectory.BulletROT= that causes missiles to ignore CruiseAltitude? Or am i doing something that i shouldn't and i didn't notice?

@CrimRecya
Copy link
Contributor Author

CrimRecya commented Apr 25, 2025

I have a long-ranged missile weapon fired by an AirstrikeFlare-spawned AircraftType. The missile uses the following projectile code.

Inaccurate=yes
BallisticScatter.Min=0
BallisticScatter.Max=.75

Trajectory=Missile
Trajectory.Missile.CruiseEnable=yes
Trajectory.Missile.CruiseAltitude=900
Trajectory.Missile.CruiseUnableRange=16
Trajectory.Missile.LaunchSpeed=10
Trajectory.Missile.Acceleration=20
Trajectory.Missile.TurningSpeed=3
Trajectory.Missile.SuicideAboveRange=0
Trajectory.BulletROT=3
Trajectory.RetargetRadius=0
Trajectory.RetargetInterval=15
Trajectory.RetargetHouses=none
Trajectory.Speed=50

I assumed this will simply make it turn very slowly, but for some reason, it ignores the designated CruiseAltitude and hits the ground like 10 cells before the target. Sometimes i don't even see the projectile spawning, so it presumably kills itself on some other obstacle i don't see.

But if i set Trajectory.Missile.TurningSpeed=5 and Trajectory.BulletROT=5 (or anything above that), it works fine. I can see the projectile properly turning to reach its CruiseAltitude and flying torwards the target.

Is there some calculation error with very low values of Trajectory.Missile.TurningSpeed= and/or Trajectory.BulletROT= that causes missiles to ignore CruiseAltitude? Or am i doing something that i shouldn't and i didn't notice?

I guess it's Gravity. The turning speed is insufficient to resist the influence of gravity.

@mevitar
Copy link

mevitar commented Apr 25, 2025

I guess it's Gravity. The turning speed is insufficient to resist the influence of gravity.

That makes sense, i have Gravity=3 set globally.

@CrimRecya
Copy link
Contributor Author

That makes sense, i have Gravity=3 set globally.

Due to differences in calculation methods and measurement units, Trajectory.Missile.TurningSpeed and Gravity require different balance conditions under different Trajectory.Speed conditions. If you don't want the Missile to be affected by Gravity, you can try defining its Gravity=0 separately.

In addition, when Trajectory.RetargetRadius=0 (default), the function will be turned off and there is no need to define Trajectory.RetargetInterval and Trajectory.RetargetHouses again.

Also, I noticed a problem with my description of Trajectory.BulletROT from your INI. It should be When it is 0, it will always face the direction defined by Trajectory.BulletFacing instead of When it is 0, it will always face the target. When it is not set to 0, its orientation will be calculated separately, separated from the velocity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Major Big stuff to do Needs testing ❓New feature ⚙️T2 T2 maintainer review is sufficient
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants