HomeWildfire Games

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

Description

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

Event Timeline

Freagarach raised a concern with this commit.Jan 12 2021, 8:58 AM
Freagarach added a subscriber: Freagarach.

Reproduce:

  • Start a match.
  • Select both the CC and another entity (with UnitAI).
  • Order them to walk somewhere.
/ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
1456

Not necessarily all entities have UnitAI.

This commit now has outstanding concerns.Jan 12 2021, 8:58 AM
Freagarach accepted this commit.Jan 12 2021, 3:28 PM

My concern was fixed :)

All concerns with this commit have now been addressed.Jan 12 2021, 3:28 PM
bb added a subscriber: bb.
bb added inline comments.
/ps/trunk/binaries/data/mods/public/gui/session/AutoFormation.js
49

The undefined here is problematic: these values end up in commands, and thus in the stringified JSON in the replay. However undefined entries are stripped upon stringification which could lead to OOS's on replay, since the undefined value is gone then. So we never should pass undefined in a command.

We should use null instead.

57

same