Opened 11 years ago

Last modified 3 years ago

#1791 reopened defect

Units command queue is reset when they enter new formation

Reported by: zoot Owned by:
Priority: Should Have Milestone: Backlog
Component: Simulation Keywords: formations
Cc: Patch:

Description (last modified by Freagarach)

Steps to reproduce:

  1. Task one soldier to gather resources.
  2. Task another soldier to gather resources somewhere else.
  3. Select both soldiers.
  4. Queue the soldiers to build a house.

What happens: The soldiers immediately stop their current task and begin building the house.

What I expected would happen: The soldiers should complete their current task before they begin building the house.

OR

Steps to reproduce:

  1. Begin building house with a soldier.
  2. Select him and another soldier and queue-order them to build another house.

What happens: The soldiers immediately stop their current task and begin building the second house. This is bad because it is very common to add workers to a building task one-by-one as they become available from other tasks.

http://trac.wildfiregames.com/raw-attachment/ticket/1791/units_cancel_order.gif

Attachments (1)

units_cancel_order.gif (1.3 MB ) - added by elexis 9 years ago.
An illustration of how the current order is canceled when the intention was to queue an order.

Download all attachments as: .zip

Change History (22)

comment:1 by zoot, 11 years ago

Description: modified (diff)

comment:2 by leper, 11 years ago

I'm not really convinced that this is a bug. I know that this happens, check GetFormationUnitAIs in simulation/helpers/Commands.js to see why.

What should happen? The newly created formation should wait for all units to finish their current tasks? What if one of those units is in a formation with a lot of queued tasks? Should the new formation wait for that one to finish? Should they just start executing the task on their own? What is the purpose of formations then?

(It doesn't happen for female citizens, because they can't use formations)

comment:3 by Jonathan Waller, 11 years ago

I agree with the sentiment that this is not worth trying to fix. UnitAI is ugly enough already, this is an unusual case and the expected behaviour is not well defined.

comment:4 by zoot, 11 years ago

Though I understand the reasoning, I very much disagree that this is an unusual case. I'm convinced a lot of people will run their head against it once they have just a tiny bit of routine.

comment:5 by Kieran P, 11 years ago

Seems like something for a design committee. To me, it seems like we need a new system here: If a unit is gathering resources, building something replaces the current order. If the unit is building something, building something else queue after the current order.

comment:6 by leper, 11 years ago

The code in Commands.js (GetFormationUnitAIs) could check each units order queue, but I don't really see how that would improve much.

comment:7 by zoot, 11 years ago

Here's an even worse case:

  1. Begin building house with a single soldier.
  2. Now order a second soldier to begin working on the same house.
  3. Now order a third soldier to begin working on the same house.
  4. While the soldiers are still building the house, select them and queue-order them to build another house.

What happens:

The soldiers immediately stop their current task and begin building the second house. This is bad because it is very common to add workers to a building task one-by-one as they become available from other tasks.

comment:8 by zoot, 11 years ago

Description: modified (diff)

comment:9 by zoot, 11 years ago

Description: modified (diff)


comment:10 by Stan, 10 years ago

Keywords: design added

comment:11 by elexis, 9 years ago

Description: modified (diff)

comment:12 by elexis, 9 years ago

At times it happened to me to build a civic centre / tower / fortress and then queuing those units to build more things or attack the enemy, expecting that they finish the building first. But they end up having the structure built only 98% and then moving away (often it wasn't noticed).

Another example is to queue some enemies to attack. They will not finish their first target before moving to the next.

leper has given some hints on irc on how to implement the update.

by elexis, 9 years ago

Attachment: units_cancel_order.gif added

An illustration of how the current order is canceled when the intention was to queue an order.

comment:13 by elexis, 9 years ago

Description: modified (diff)
Keywords: design removed
Priority: Should HaveMust Have
Summary: Citizen soldiers' command queue is reset when they enter new formationUnits command queue is reset when they enter new formation

comment:14 by wraitii, 8 years ago

Milestone: BacklogAlpha 20

comment:15 by mimo, 8 years ago

moved back to backlog as no activity

comment:16 by mimo, 8 years ago

Milestone: Alpha 20Backlog

comment:17 by Imarok, 5 years ago

Component: UI & SimulationSimulation

Move tickets to Simulation as UI & Simulation got some sub components.

comment:18 by Freagarach, 4 years ago

Description: modified (diff)
Milestone: Backlog
Resolution: invalid
Status: newclosed

Fixed along the way. Somewhere between A20 and A23b apparently. A not so quick search couldn't find a relevant commit.

comment:19 by Freagarach, 4 years ago

Keywords: formations added
Milestone: Backlog
Resolution: invalid
Status: closedreopened

Ouch, I was too trigger happy.

First, see also #3479, secondly, the issue still exists, albeit only using formations. So perhaps these tickets can still be closed and a new one specifically for formations can be made.

comment:20 by wraitii, 3 years ago

In 24480:

Allow picking a default formation for walk (and walk-like) orders.

This allows choosing a "default formation", which is activated automatically for units given walk orders (and attack-walk etc.).
Conversely, units in formation that are given a gather/build/... order are taken out of formation and given the order individually.
The default formation can be selected by right-clicking on any formation icon.

This leverages formations for walking, where they are quite efficient (in fact, perhaps too efficient), while circumventing issues with various orders.

Choosing the "null formation" as the default formation de-activates the behaviour entirely, and plays out exactly like SVN.

This makes it possible to queue a formation-order then a noformation-order (i.e. walk then repair), though the behaviour isn't very flexible.

For modders, it should be relatively easy to change the setup for each order, and/or to force deactivating/activating formations in general.

Tested by: Freagarach, Angen

Refs #3479, #1791.
Makes #3478 mostly invalid.

Differential Revision: https://code.wildfiregames.com/D2764

comment:21 by wraitii, 3 years ago

Priority: Must HaveShould Have

(I think this was referring to formations since back then they were active by default).

The root cause of this 'bug' is that units are immediately put in formation, as they discard their current order. As written above, doing this in a "deferred" manner seems non-trivial: should units wait for others? How to determine which units should be part of the formation in the future? How to handle deaths? It's unlikely that all units will stop their current order at the same time. All that seems rather complex, and possibly un-necessary.

r24480 / Phab:rP24480 introduces "formation->noformation" queuing but that's much easier than the opposite, and it's still _kinda_ hacky. Further, that diff circumvents the issue by using formations for walking only, and by ignoring formations for queued orders (fixing the reproduction above of 'assign units to buildings, then queue a move order)

I don't think the ticket is necessarily invalid or fixed, but it's no longer a 'must have' IMO.

Note: See TracTickets for help on using tickets.