Page 1 of 1

unitDef= maximal possible/minimal needed distance for attack

Posted: 28 Jul 2013, 05:48
by PepeAmpere
Currently "maximal possible"/"minimal needed" distance for attack is somehow calculated from shoot range of weapon with the longest shoot range. For units with 2+ weapons (some ordinary weapon + special weapon) its very uncomfortable solution.

I think this thing should be solved by engine, if we would agree attack command execution is engine task :).

Requested on mantis: http://springrts.com/mantis/view.php?id=3900

-------------------------------

Examples of use (in all examples unit gets attack command when 3000 from target):
Unit1 (Headhunter)
- Weapon1: Sabre - Melee (range: 30, DMG: 1500, reload: 1sec)
- Weapon2: Net (range: 800, DMG: 0-20, reload: 15sec, => stun target for 8 seconds)
Result in Spring 94.1: Unit will run to trunget, when 800 from target, it will use the Net, target is stunned, but after it Headhunter just stay 800 from target and do nothing until target moves away or Net is reloaded.

Btw in Spring 91 Unit1 this unit would work ok, because there was some ancient primary/secondary selection of weapons. But yes, i understand why it was changed.
Unit2 (Bismark Zuckerberg - battleship)
- Weapon1: Tripple plasma (range: 850, DMG: 300, reload: 3secs)
- Weapon2: Tripple plasma (range: 850, DMG: 300, reload: 3secs)
- Weapon3: Tripple plasma (range: 850, DMG: 300, reload: 3secs)
- Weapon4: Dua long plasma (range: 1000, DMG: 250, reload: 4secs)
- Weapons5-10: Some shity guns (range: 300-500, DMG: 10-100, reload: variable)
Result in Spring 94.1: Battleship goes to target, when 1000 from target, Weapon4 shoots, and ship is stopped, use only one weapon, because for rest of them target is far away from them.

-------------------------------

Solution:
  • make UnitDef called "MaxAttackDistance" (default <= range of weapon with the longest range, integer)
  • make Lua SyncedCtrl "Spring.SetMaxAttackDistance(unitID)" which can set/change the default/defined value.
Thx, if it can be in 95.0 :mrgreen:

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 28 Jul 2013, 06:01
by smoth
why not do min attack as well? that way we can set a range for the unit to try and get within(would be handy with artillery units)

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 28 Jul 2013, 06:03
by PepeAmpere
smoth wrote:why not do min attack as well? that way we can set a range for the unit to try and get within(would be handy with artillery units)
Hm, true, currently minimal range for some long range bastards is solved by adding some second "not real weapon", isnt it?

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 28 Jul 2013, 06:12
by smoth
I suppose some might. I wouldn't want to do that though.

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 06 Aug 2013, 20:41
by raaar
this is a good idea

also useful for gunships (ex : big gunship with short range rockets + long range missile)

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 31 Aug 2013, 13:36
by TheFatController
There used to be a workaround for this I used for BA Chicken Defense units, the unit would move into the range of Weapon1, so theres a few units with fake weapons with smaller ranges to set their engagement range.

Something changed in a Spring update and now units just stop at the range of their longest range weapon.

Something to set the desired engage range on an attack command would be very useful to fix this.

Re: unitDef= maximal possible/minimal needed distance for at

Posted: 06 Sep 2013, 23:12
by PepeAmpere
I made hot fix which changes (lower) the range of "longer" weapon after each shot and change it back when weapon reloaded. But its silly solution (work well just for our Dust bug which has 20 secs long range weapon reload), not general solution for every unit and weapons combinations. So touch from engine gods would be sweet ending of this summer.