Opened 19 months ago

Closed 18 months ago

Last modified 18 months ago

#3932 closed enhancement (fixed)

[PATCH] Make healer UnitAI more proactive

Reported by: causative Owned by: mimo
Priority: Should Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description (last modified by causative)

Currently, healers are difficult to use. This is due to two problems with their UnitAI.

First, if an idle healer is near a damaged unit, the idle healer will not walk to heal the unit unless the initial distance between them is very short - the healer's LOS, 30. This makes it difficult to position your damaged army so healers will do their job. This patch fixes this by doubling healer LOS to 60. It does not change healer range, which remains 12 before upgrades.

Second, if you select a group of healers and soldiers and attack-move (ctrl + right-click on an empty area) with them, the healers will just march straight at the enemy and not heal anything. This patch fixes this by making healers on attack-move heal any injured allied units they pass.

The second part of the patch does not apply to healers in formation. The reason is, if there is a mixed formation of healers and soldiers, you don't want to issue the entire formation a HEAL command, because the soldiers can't obey it.

To test this patch: open a scenario with enemy units and healers. Let an enemy injure a unit, then move him near the idle healers. They should walk several times their range to heal the injured unit. Then, move the healers far away again, and with the healers selected, ctrl + right-click past the injured unit. They should heal the injured unit instead of walking past him.

Attachments (3)

healerAI.diff (4.4 KB) - added by causative 19 months ago.
healerfinal.diff (5.0 KB) - added by causative 18 months ago.
slight nonfunctional changes
healer_mod.patch (5.5 KB) - added by mimo 18 months ago.
my proposition following discussion on IRC: based on causative patch, but decrease a bit the heal range increase from tech, and also decrease a bit the metal cost of the heal_range techs as they now give less improvment.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 19 months ago by causative

Summary: Make healer UnitAI more proactive[PATCH] Make healer UnitAI more proactive

title should be prefixed with [PATCH]

comment:2 Changed 19 months ago by elexis

Keywords: review removed

Thanks for finding the issue and making a patch!

But don't change UnitAI to double the range, just change the template! Also that pair of braces is not needed.

comment:3 Changed 19 months ago by causative

Description: modified (diff)

comment:4 Changed 19 months ago by causative

Doubled healer vision instead of changing UnitAI for issue 1.

comment:5 Changed 19 months ago by mimo

As some mods could have healers which are also soldiers, it's better imo to give priority to the fighting possibility rather than to the healing one, so move the FindNewHealTargets? at the end of the function, just before the final return false

comment:6 Changed 19 months ago by causative

Updated the patch so FindNewHealTargets? gets called at the end of the function.

comment:7 Changed 19 months ago by sanderd17

I think that part of the problem is that the heal range gets enlarged for advanced and elite healers, but their vision range isn't enlarged (see the relevant technologies).

Perhaps you can keep the vision range as it was, but enlarge it with the techs too.

comment:8 Changed 19 months ago by causative

Yes; I noticed that, for example, with both healer range upgrades they will refuse to walk at all to heal units, because that gives them a heal range of 28 and a vision range of 30. I've reverted healer vision range to 30, and added +15 vision range for each healer range upgrade.

Last edited 19 months ago by causative (previous) (diff)

comment:9 Changed 19 months ago by fatherbushido

Sanderd17 was speaking of that too:

simulation/data/technologies/advanced_unit_bonus.json
simulation/data/technologies/elite_unit_bonus.json

Changed 19 months ago by causative

Attachment: healerAI.diff added

comment:10 Changed 19 months ago by causative

Oh, I see. That would mean updating advanced_unit_bonus.json, elite_unit_bonus.json, healer_range.json, and healer_range_2.json. Are you sure it wouldn't be better to just increase the base healer vision range? It wouldn't affect anything other than UnitAI because nobody's using healers for scouting.

Anyway, I've made the change.

comment:11 Changed 19 months ago by mimo

I've the impression that the vision range would become quite big with these changes (up to 76m when all techs), and also the heal range was really big (up to 36m when all techs). In the opposite, the initial vision is maybe too small. So i would propose to tune them a bit. Currently we have

                     Heal / Vision ranges
default                12 / 30
heal_range tech (x2)   +8 / +0 (+0 -> +15 in the patch)
promotion  (x2)        +4 / +0 (+0 -> +8  in the patch)

I would go for something like

default                12 / 40
heal_range tech (x2)   +6 / +8
promotion       (x2)   +3 / +4

comment:12 in reply to:  11 Changed 19 months ago by causative

Your proposed changes sound fine to me. Can we get some consensus before changing it though?

Myself, I think there's no problem with heal range since even 36m heal range for an elite healer with both upgrades is pretty short range - slightly more than a celtic chariot. Heal range is almost irrelevant unless you're sending the healer into combat, and a fragile healer 36m away from combat is still very close and vulnerable. However, your proposed reduction to heal range is fairly minor so I'm OK with it.

Last edited 19 months ago by causative (previous) (diff)

comment:13 Changed 19 months ago by mimo

I don't get the connection with the celtic chariot ?

IMO a healer should be nearby the healed unit (more realistic and makes him in danger if the player wants to abuse it and heals units during a combat phase). With the current big range, you may have two sets of healers, one at 36m which heal your soldiers, and one at 72m (so out of range of most enemy units) which heals the healers. So my own preference would be to decrease the heal range still more than what i proposed above :-)

On the opposite, increasing the vision range is fine as it will decrease a bit the micro (the vision range is used as the distance inside which the healer will search for injured units and move towards them and heal them). But it should not be too big such that UnitAI will not sent them in places you would not want.

comment:14 Changed 19 months ago by causative

I mentioned the celtic chariot because it's a unit I have experience using en masse. Even though chariots are fast and tough, it's usually hard to retreat in time to avoid losing chariots once the enemy infantry approach, as a result of the chariots' short range, which is similar to healers with full upgrades. By comparison to chariots, healers are very slow and fragile, with 1/3 the hp and no armor. Having a second row of healers behind the first row of healers would not stop them from being quickly slaughtered if the enemy is targeting them.

You have a point that it's less realistic to have healers heal from any distance, even 12 meters.

There's another point about healer balance: a healer without upgrades heals one unit at 2.5 hp/second, and a temple without upgrades heals 20 garrisoned units at 3 hp/second each. So using healers outside of combat is a questionable decision except in certain special cases. Primarily, their value is in sending them into combat.

Last edited 19 months ago by causative (previous) (diff)

comment:15 Changed 18 months ago by causative

Would someone please commit at least the portion of the change that makes healers heal on attack-move?

comment:16 Changed 18 months ago by causative

Keywords: review added

comment:17 Changed 18 months ago by causative

Per sanderd17's suggestion on IRC, I have adjusted the patch so that when the healer is promoted or gets upgraded, it adds the same amount of vision as it does extra range. Also added myself to credits and updated the patch to latest svn.

Changed 18 months ago by causative

Attachment: healerfinal.diff added

slight nonfunctional changes

Changed 18 months ago by mimo

Attachment: healer_mod.patch added

my proposition following discussion on IRC: based on causative patch, but decrease a bit the heal range increase from tech, and also decrease a bit the metal cost of the heal_range techs as they now give less improvment.

comment:18 Changed 18 months ago by mimo

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 18280:

make healer more proactive, patch by causative, fixes #3932
decrease a bit the increase of heal range with techs, and also decrease a bit the cost of such techs

comment:19 Changed 18 months ago by mimo

Keywords: review removed

Thanks for the patch

Note: See TracTickets for help on using tickets.