Opened 9 years ago

Closed 4 years ago

#3144 closed enhancement (fixed)

Formations - 'Dropoff resources and move somewhere else' doesn't work properly with many units in formations

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Alpha 24
Component: Simulation Keywords:
Cc: Patch:

Description (last modified by elexis)

If you have like 40+ units, gathered some resources with them, right click storehouse and shift-rightclick somewhere else, then you expect the units to go to the storehouse and then go to the next target in formation after that.

Without formation they do. With formation they surround the storehouse. The units that dropped of their resources keep waiting at the storehouse, until the other units have dropped off.

However since they surrounded the storehouse already, some units cant droppoff.

Those units then walk around for about 30 seconds until every unit has reached the closest point to the storehouses possible. The "dropoff resources" command is cancelled then and finally the units do the next command.

https://trac.wildfiregames.com/raw-attachment/ticket/3144/surrounded_storehouse.gif (due to the limitation of gifs I could only upload a sample where they wait for few seconds, but they can wait up to 80 seconds with more units).


On 2015-03-24-QuakeNet-#0ad-dev.log, leper said it 'could just be fixed by making sure the units are in the same formation and disabling collision checks for them'

Attachments (1)

surrounded_storehouse.gif (1.5 MB ) - added by elexis 9 years ago.
Sample with 25 units. The problem gets worse with the number of units. If you do it with 100 units, it will consume 80 seconds.

Download all attachments as: .zip

Change History (13)

comment:1 by elexis, 9 years ago

10 fishing boats have the same problem with docks.

Version 0, edited 9 years ago by elexis (next)

by elexis, 9 years ago

Attachment: surrounded_storehouse.gif added

Sample with 25 units. The problem gets worse with the number of units. If you do it with 100 units, it will consume 80 seconds.

comment:2 by elexis, 9 years ago

Description: modified (diff)

comment:3 by elexis, 9 years ago

Component: Core engineUI & Simulation
Priority: Nice to HaveShould Have
Summary: [Formations] 'Dropoff resources and move somewhere else' doesn't work properly with many units in formationsFormations - 'Dropoff resources and move somewhere else' doesn't work properly with many units in formations

comment:4 by Imarok, 5 years ago

Component: UI & SimulationSimulation

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

comment:5 by wraitii, 5 years ago

Description: modified (diff)

Still happens with the UM changes.

I agree with leper above, the diagnostic is first that some units in INDIVIDUAL.RESOURECERETURN.APPROACHING can't get in-range of the storehouse as there are other units in the way, and these aren't part of the same formation since locally these are individuals.

Possibly then going back in formation is also buggy.

This is tricky to fix - keeping units to have the same obstruction group when in individual orders seems dangerous (attacking?), making units go to the next waypoint not in formation when they deposited would fix the stuck-ness but not the formation behaviour. Possibly we should add an intermediate order to go away from the store-house in these cases?

Alternatively unit Pushing would likely fix this.

comment:6 by wraitii, 5 years ago

Milestone: BacklogAlpha 24
Owner: set to wraitii

Err, actually, this appears to work fine with some more changes. One problem is that not all units could drop their resources - this was because of broken behaviour in PathResult, which I've fixed upstream.

Then units got stuck in "INDIVIDUAL.IDLE", but moving them back to FORMATION.IDLE appears to have done the trick.

See D2048 (and the upstream D1907).

comment:7 by wraitii, 5 years ago

In 22447:

Fix Formation walking / other orders with the new UnitMotion

This fixes a number of issues with formations:

  • Gives the controller an obstruction. This fixes the bug where units in formations can't gather from a tree.
  • Stop special-casing formation members in PathResult. This fixes formation members being stuck in-place when they run in an obstruction.
  • Makes sure units stay in Formation.IDle when they are idle so that D1337/D1901 can work correctly in the IDLE state.
  • Warn if animals enter this state.
  • Make sure that formation members that end up in INDIVIDUAL.IDLE go back to FORMATION.IDLE for sanity and for better housekeeping (refs #3144 - fixed completely upstream).

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

comment:8 by wraitii, 5 years ago

This is mostly fixed following D2048 and D1907 - in some situations units will still be "dancing" between two valid paths which means the formation as a whole remains stuck. I have an idea on how to fix that final issue, but the behaviour otherwise works.

Leaving open for now.

comment:9 by wraitii, 5 years ago

In 22566:

UnitMotion - reject paths that would not take the unit closer to the goal than it is now.

This helps with #3144 and units not going idle when ordered to clump together.

By rejecting paths that would not take the unit closer to the goal than it is, we can avoid the case where a unit at A finds a short path to B, goes there, gets stuck, finds a new short path to A, etc. ad infinitum.

It doesn't completely fix the problem since two units moving might still occasionally become stuck against one another, but it makes it rarer (unit pushing would probably finish solving this).

This assumes that being as close as possible to the goal is the best behaviour when trying to move somewhere, even when it is unreachable.

Refs #3144

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

comment:10 by wraitii, 5 years ago

Owner: wraitii removed
Priority: Should HaveNice to Have

The above change will have further helped, but I think this needs unit pushing to be completely done, and I don't see that happening for A24.

Leaving open as this isn't fixed quite completely.

comment:11 by elexis, 5 years ago

Description: modified (diff)
Milestone: Alpha 24Backlog

comment:12 by Freagarach, 4 years ago

Milestone: BacklogAlpha 24
Resolution: fixed
Status: newclosed

I don't know exactly when this was fixed, but with r23587 entities will drop off resources and move to their formation controller when dropping of resources, thus fixing this issue.

Note: See TracTickets for help on using tickets.