Tank & Plane LUS


#1

Design rambling, feel free to comment/ignore

Main issue with tanks is targeting, the AllowWeaponTarget will have to be implemented to decide on targets in an intelligent fashion:

  • Did the player issue a manual target?
  • What’s the current weapon priority? (HE, AP, or even MG if there’s no ammo)
  • Is the target close to the turret heading? (For instance, a lower priority weapon should always target whatever is closest to the turret)
  • Can we deal damage to this target?
  • Can this target deal damage to us?

The callin will then store the chosen target for each weapon for later use by the script.

In the script there’s going to be a main function analysing the current targets and state to decide on the desired bodyHeading and turretHeading, which will be called every time one of them changes, every reaim etc.
This function may be generic for units with and without turrets.

Aim functions should return true if the turret is pointing to the general direction of the target and if the ammo isn’t locked at the moment (we don’t want a reload if we’re actually aiming at something else).

Firing should halt turret spinning (mostly relevant to MG)

Nice to haves:

  • In order to fire a shell faster a tank will rotate both body and turret.
  • If there’s no target in range, rotate the turret/body to a target outside range
  • Make drive by shooting less micro-ey (tank will be able to intelligently aim beforehand)

#2

The interplay between engine ‘pointing’ of the unit (over which we have effectively zero control unless we force the unit to 0 velocity), setting heading directly, and turret rotations is going to make much of this very hard…

Not sure how convenient passing stuff back and forth between AllowUnitWeaponTarget and LUS will be, either. Is TargetWeightX called before or after AimX?

edit: Looks like TargetWeightX is called before AllowUnitWeaponTarget, but doesn’t in itself allow you to reject a target altogether

Maybe we could modify the LUS base to add script.AllowWeaponTarget(weaponID, targetID)


#3

Indeed I had something similar in mind. The AllowWeaponTarget will CallAsUnit the appropriate function in the unit.

TargetWeight isn’t good enough because it returns a priority multiplier, and not an absolute new priority.


#4

If we set one target’s weight to exactly 0, doesn’t this effectively prevent fire at that target (if there are some other enemies nearby)?


#5

lower priority is more likely to be picked, but yes giving a huge number will probably mean target won’t be picked.


#6

Plane stuff:

  • Usual stuff like weapons, and not firing when having fear
  • Replace engine crashing behaviour as it just doesn’t work. My suggestion is replacing the plane with a feature with same position and speed, add CEGs for smoke and gadget an explosion when it hits ground.
  • Better diving/bombing? it may be possible to lower altitude and speed a bit when getting near target, and block firing if you’re not in the correct height.