Opened 2 years ago

Closed 2 years ago

#6377 closed defect (fixed)

UnitAI error code being displayed

Reported by: Langbart Owned by: Freagarach
Priority: Should Have Milestone: Alpha 26
Component: Simulation Keywords: UnitAI regression
Cc: Patch: Phab:D4349

Description (last modified by Langbart)

When playing a game on Alpha 25b [25860], some errors occurred and even when viewing the replay with and without mods, the error remains the same.

0 A.D. (0.0.25) Main log (warnings and errors only)
ERROR: JavaScript error: simulation/components/UnitAI.js line 6143 Failed to construct Vector3D object

ERROR: Failed to call ProcessCommand() global script function

Engine exited successfully on 2021-11-10 at 21:53:01 with 1604 message(s), 2 error(s) and 0 warning(s).

The error is displayed only once after about 10 seconds in the game. I will attach the replay as a zip file, I have never seen this error before.

Line 6143 in Unitai.js at [25860]

Line 
6137UnitAI.prototype.RememberTargetPosition = function(orderData)
6138{
6139 if (!orderData)
6140 orderData = this.order.data;
6141 let cmpPosition = Engine.QueryInterface(orderData.target, IID_Position);
6142 if (cmpPosition && cmpPosition.IsInWorld())
6143 orderData.lastPos = cmpPosition.GetPosition();
6144};

Attachments (3)

unitai_error_replay.zip (246.6 KB ) - added by Langbart 2 years ago.
unitai_error.jpg (344.1 KB ) - added by Langbart 2 years ago.
commands.txt (1.9 KB ) - added by Freagarach 2 years ago.
No modding needed, merely a queued gather order.

Download all attachments as: .zip

Change History (8)

by Langbart, 2 years ago

Attachment: unitai_error_replay.zip added

by Langbart, 2 years ago

Attachment: unitai_error.jpg added

comment:1 by Langbart, 2 years ago

Description: modified (diff)

Adding the referenced line of code from the error to the description.

comment:2 by Freagarach, 2 years ago

Component: Core engineSimulation
Keywords: UnitAI added
Owner: set to Freagarach

The problem is entity 408 (of player 7) trying to attack entity 425 (a chicken) whilst garrisoned. I have to investigate further. I mean, I have no clue why it can't construct a vector, but it seems the entity is in some kind of infinite loop. It sounds easy enough to reproduce on SVN with some replay modding.

by Freagarach, 2 years ago

Attachment: commands.txt added

No modding needed, merely a queued gather order.

comment:3 by Freagarach, 2 years ago

Patch: Phab:D4349

comment:4 by Freagarach, 2 years ago

Keywords: regression added

comment:5 by Freagarach, 2 years ago

Resolution: fixed
Status: newclosed

In [26044]:

Fix infinite loop when queuing a gather order after garrison.

There was an infinite loop:
Order.Gather -> MustKill (L497) -> PushOrderFront(Attack) (L526) -> NotInRange (L410) -> NotAbleToMove, thus finish order (L426/427) -> Restart from Order.Gather.

We do two things here:

  • Assume we don't have vision when garrisoned, which is not a bad assumption.
  • Check the range and if we are not able to move and not in range, finish the order.

Introduced in: r25030 / rP25030
Reported by: @Langbart
Differential revision: ​https://code.wildfiregames.com/D4349
Fixes: #6377
Tested by: @Langbart
Comments by: @Silier, @Stan

Note: See TracTickets for help on using tickets.