Open Crimsonum opened 3 years ago
At 0x0063D5A7
in TechnoTypeClass::In_Range
is a check for Arcing=yes
.
From a quick look, if the projectile has Arcing=no
, the game seems to just use the Range=
specified on the weapon for the "is-target-in-range" calculation. If the projectile instead has Arcing=yes
, the game does some more complex 3D vector math involving the weapon range, gravity and such, giving the projectile more range. This more complex check is an addition to the code in TS that wasn't there in RA, meaning this was probably considered a feature by Westwood.
However, this extra range was only added in TechnoTypeClass::In_Range
; the "pick cell to move into when approaching target that is out of range" logic doesn't seem to contain this more "advanced" range calculation and instead only uses the weapon range, regardless of the Arcing=
setting of the projectile. This causes the bug where the extra range is only taken into account when you target something that's within the extended range, and ignored otherwise.
The following code disables the extra range in all cases. It should probably not be included in Vinifera by default though because this bug has an effect on vanilla gameplay, and it also disables extra range from elevation.
/**
* #issue-90
*
* Disables the bugged bonus range for arcing projectiles.
*
* Author: Rampastring
*/
DECLARE_PATCH(_TechnoTypeClass_In_Range_Disable_Arcing_Bonus_Range_Patch)
{
JMP(0x0063D6AA);
}
/**
* Main function for patching the hooks.
*/
void TechnoTypeClassExtension_Hooks()
{
Patch_Jump(0x0063D5A7, &_TechnoTypeClass_In_Range_Disable_Arcing_Bonus_Range_Patch);
}
Description:
Units with arcing projectiles (
Arcing=true
) have some 20–25% higher range than indicated by their weapons'Range
value, on flat terrain. This potentially gives them an unfair advantage and makes comparing weapon stats more complicated. For example, although they have the sameRange
values, a Tick Tank is able to outrange a Titan.In addition, this extra range is not taken into account when giving attack commands to distant targets. If the target is out of range, the unit will still move to the distance specified by
Range
before attacking. This supports the conclusion that this extra range is an unintentional oversight.Steps To Reproduce:
Range
values, preferably 5 or higher.Expected Behaviour:
On flat terrain, arcing projectiles should gain no extra range compared to other projectile types. However, on high ground, it's logical for them to gain increased range.
Additional Files:
For the purpose of this demonstration, all the units were given
Range=10
. As distance to the target increases beyond 10 cells, note how the tank remains still while the infantry have to reposition themselves.