Idea for turret-mounted machinegun implementation in LUS


#1

This concerns units which have turret machineguns, sometimes pointing away from the direction main gun is facing (those would include, for example, some Japanese tanks).

The idea is this: implement TargetWeight callin for the turreted MG weapon(s) that compares direction to the target unit to current turret rotation, and sets weight to 0 for targets outside machinegun’s fire arc. This way the MG fires at targets of opportunity correctly, but won’t cause the turret to rotate thus breaking aim for main gun.

This can only be properly implemented in LUS as COB has no (easy) access to info about relative piece rotations so can not know where the turret is facing now.

Advantage would be that turret MGs would function correctly - they do not currently (test with a tank vs inf and see that MG starts firing at things way before turret turns to face them).
Drawbacks are potentially heavier CPU load from having to compute angles to every suitable target in range every time the weapon retargets (no idea how much load that would actually cause)


#2

Makes sense, though why not implement this in the script Aim callin?

The entire tank targeting will need some love (I think it was you that mentioned tanks shouldn’t waste ammo on units they can’t affect).


#3

Yes, and that’s another use for TargetWeight. Making AP weapons behave in a saner way is probably even more important (since they can’t really be manually controlled on units that have both HE and AP).

Why this can’t be done in Aim: there we can only block current target. Machinegun will only fire when the engine randomly picks a target that is inside arc, which is not guaranteed to happen fast (retargeting does not happen every frame afaik). If we limit target list with TargetWeight, however, then this will happen much more frequently (at least that’s how I see internal targeting mechanics, I can be mistaken here).


#4

I now understood what you mean and you’re entirely correct :slight_smile:
Also, we should remember that when out of ammo, the MG gets priority!
btw, the manual aim vs. AP shouldn’t be hard to fix, you just need to store somewhere what was the last manual target of your unit (probably through commandfallback, or the settarget command) and aim/block accordingly.


#5

Much can be done with TargetWeight and BlockShot, can’t quite remember but I think blocking with blockshot may then cause next target to be tried. If not automatically then there is a callout for it.