Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3086 closed defect (fixed)

[PATCH] Units stop attacking and errorspam for some formations

Reported by: auron2401 Owned by: mimo
Priority: Must Have Milestone: Alpha 19
Component: UI & Simulation Keywords: patch
Cc: sanderd17 Patch:

Description (last modified by elexis)

Reproduce steps: Have a formation (i reproduced using multiple groups of 50 in different formations - but works vs non such things as well) and press the stop button, units will stop attacking things, halt into a formation-looking shell, and stare the enemy into oblivion.


Symptoms: error spam, units stop attacking Affected formations: phalanx, skirmish, syntagma, testudo, wedge (see comment:7) Severity: recoverable Reproduce: See comment:6 Solution: Patch proposed in comment:7 and comment:9

Attachments (5)

commands.7z (50.8 KB ) - added by auron2401 9 years ago.
Commands.txt with error log.
replay_log_auron.7z (9.6 KB ) - added by elexis 9 years ago.
4MB or errors that occur when replaying auron's commands.txt
commands.txt_replay_log_elexis.7z (109.5 KB ) - added by elexis 9 years ago.
commands.txt & replay log of my match where I encountered the same bug
commands.txt (9.6 KB ) - added by elexis 9 years ago.
The bug still exists on r17091 and as mimo stated also occurs with other formations.
formationAttack.diff (7.2 KB ) - added by mimo 9 years ago.

Download all attachments as: .zip

Change History (25)

by auron2401, 9 years ago

Attachment: commands.7z added

Commands.txt with error log.

comment:1 by auron2401, 9 years ago

Also, I can reproduce locally. But the commands.txt above was done online. SBB was also getting errors.

comment:2 by elexis, 9 years ago

This happened to me yesterday in a SVN 2v2 too. I sent 20 units and they were standing still and being slaughtered without attacking back.

by elexis, 9 years ago

Attachment: replay_log_auron.7z added

4MB or errors that occur when replaying auron's commands.txt

by elexis, 9 years ago

commands.txt & replay log of my match where I encountered the same bug

comment:3 by elexis, 9 years ago

Moving units in formation, attacking, pressing stop button is not enough to reproduce this issue.

The error messages in the logs are not that useful (mostly UnitAI.order.data not found). This error appears on a timer call too. But I'm sure we can reproduce this issue soon. In my match I had some units with formation, some without.

comment:4 by elexis, 9 years ago

In auron's logfile all errors appear in turn 2289-2302, in my logfile 1030-1072.

In my logfile I played as player 2 and the 19 units which probably caused the issue had the following entity numbers: 254,255,3865,3866,3867,3868,3869,3993,3994,3995,3996,3997,4069,4083,4255,4256,4257,4258,4259

Last edited 9 years ago by elexis (previous) (diff)

comment:5 by elexis, 9 years ago

In both logs, the errors appear when the 'Stop' command is issued (turn 2289 / 1030). Before that attack commands were issued for those entities.

comment:6 by elexis, 9 years ago

Its the skirmish formation (available to ranged units only).

Steps to reproduce: -select ranged units -select skirmisher formation -attack unit or building (including to cause some damage) -hit H / Stop button -many errors appear

Notice that I didn't yet reproduce the issue of units not willing to fight in this situation!

Also: this error doesn't occur when I put diplomacy to neutral for both players.

comment:7 by mimo, 9 years ago

Looking at the code (line 4306 of UnitAI.js), the problem should not be not specific to skirmish formations, but to all formations with CanAttackAsFormation=true. I've not looked at the formation code in UnitAI since quite some time, so I add sanderd17 in copy here, but the problem seems to come from the fact that the formation is still in the COMBAT.ATTACKING state while it has no more orders. Shouldn't a stop put the formation in IDLE state when no more orders ?

In addition, there is another potential problem in line 4199 of UnitAI.js, where the tested state should be "FORMATIONCONTROLLER.COMBAT.ATTACKING" and not ""FORMATIONCONTROLLER.ATTACKING"

comment:8 by mimo, 9 years ago

Cc: sanderd17 added

comment:9 by elexis, 9 years ago

Stop should transition them into idle state and then the unit stance again should make them attack automatically (which doesn't seem to happen according to the bug description and i think in my match it happened too).

I tried multiple times but couldn't reproduce this issue with melee or other formation. With skirmisher formation it worked everytime.

in reply to:  9 comment:10 by mimo, 9 years ago

Replying to elexis:

Stop should transition them into idle state and then the unit stance again should make them attack automatically (which doesn't seem to happen according to the bug description and i think in my match it happened too).

yes, but i'm not sure if it should be the IDLE state or the MEMBER state. But anyway, any state different from COMBAT.ATTACKING would solve the bug.

I tried multiple times but couldn't reproduce this issue with melee or other formation. With skirmisher formation it worked everytime.

have a look in simulation/templates:formations to see which one can attack as formation. It is only skirmish, wedge, phalanx, syntagma and testudo.

comment:11 by elexis, 9 years ago

Unfortunately this bug can be used to jam the chat of all players until the affected units die.

comment:12 by elexis, 9 years ago

Milestone: BacklogAlpha 19

comment:13 by elexis, 9 years ago

Summary: Formations ErrorFormations - Units shouldn't remain in ATTACKING state when having no orders

comment:14 by Itms, 9 years ago

Milestone: Alpha 19Alpha 20

by elexis, 9 years ago

Attachment: commands.txt added

The bug still exists on r17091 and as mimo stated also occurs with other formations.

comment:15 by elexis, 9 years ago

Component: Core engineUI & Simulation
Description: modified (diff)
Priority: Should HaveMust Have
Summary: Formations - Units shouldn't remain in ATTACKING state when having no ordersUnits stop attacking and errorspam for some formations

(posted summary in the ticket description)

Last edited 9 years ago by elexis (previous) (diff)

comment:16 by mimo, 9 years ago

In 17093:

temporarily disable the AttackAsFormation, refs #3086

comment:17 by mimo, 9 years ago

Keywords: patch review added
Summary: Units stop attacking and errorspam for some formations[PATCH] Units stop attacking and errorspam for some formations

Here is a patch which should fix the problems reported, but thorough tests would be welcomed. The units stopping the attack was (in my tests) due to the formation rearranging when one of their member dies which is not compatible with the attackAsFormation, so it is disabled in the patch when attackAsFormation.

by mimo, 9 years ago

Attachment: formationAttack.diff added

comment:18 by elexis, 9 years ago

Your patch seems to work, although (without the previous commit and your patch) this error can be triggered without having anyone die.

Last edited 9 years ago by elexis (previous) (diff)

comment:19 by mimo, 9 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 17106:

fix attackAsFormation of special formations, fixes #3086

comment:20 by mimo, 9 years ago

Keywords: review removed
Milestone: Alpha 20Alpha 19
Note: See TracTickets for help on using tickets.