MegaGlest Forum
MegaGlest => Bug reports => Topic started by: ctz on 3 January 2015, 01:33:41
-
Normal attacks basically target the closest unit with an attack skill, or if none exist, the leftmost in-range enemy unit (with no attack skill of course). The target is chosen in the function attackableOnRange in source/glest_game/world/unit_updater.cpp.
The attack_stopped skill (hold_position, towers), however, only attacks the leftmost unit, regardless of whether it has an attack skill. This often results in a single unit drawing fire from all towers that can fire at it, often resulting in a waste of shots. Also, it causes tower performance to vary depending on the direction of the attack--players attacking from the left will have their ranged units attacked first by towers.
This is because the function updateAttackStopped finds its target using unitBeingAttacked, which just gives the leftmost unit. It also has a use of attackableOnRange like the normal attack does, but only if unitBeingAttacked fails, and I don't think that branch is ever followed when there is actually anything to attack.
Thus, applying [url=http://pastebin.com/imfv9kcK]this diff[/url] results in the same behavior for attack_stopped as normal attack.
[url=http://s000.tinyupload.com/index.php?file_id=05647447169642467245]This scenario[/url] may demonstrate the inefficiency of the leftmost-first targeting in the case of anti-air towers. Leftmost-first targeting also means that towers with reduced range (e.g. 12 instead of 15) can be more effective than those with greater range, since they will have different targets and thus waste fewer shots.
Leftmost-first doesn't matter as much when there are only units that can't attack, since players are usually in the "destroy the helpless base" stage of the game when that happens.
-
I think it may be better to fix the unitBeingAttacked thing because this is often used as hold position. And in that case it would be better to have a functional unitBeingAttacked function.
-
:) this will not be changed because:
What you describe is true and it can be implemented much more efficient, but thats exactly not what I want. I want to encourage people to manage their fights manually because this is an important part of having fun playing the game. The CPU generally acts dumb, but you maybe saw, that the CPU-Mega acts different and fights a bit better ;) . This can maybe be improved in the future if people think the ultra or mega CPU plays too bad but I don't want the default fighting strategy to be better, because this would kill the advantage of manual fight micromanagement.