Skip to content

Comm order types modder-configurable (take 2) - #7776

Open
wookieejedi wants to merge 18 commits into
scp-fs2open:masterfrom
wookieejedi:7721-update
Open

wookieejedi wants to merge 18 commits into
scp-fs2open:masterfrom
wookieejedi:7721-update

Conversation

@wookieejedi

Copy link
Copy Markdown
Member

Regarding #7721, it turns out that it needs all kinds of edge case handling and other aspects to work properly, so here is a PR to supersede it.

Original Description:
Comm order types (that is, the list of things that can be messaged -- ships, wings, reinforcements, etc.) are now no longer a fixed list. Of the eight possible types, the modder may specify an arbitrary list in arbitrary order, with text specified in the table.

This was to facilitate the addition of two new types, All Fighters and All Bombers -- as distinct from the retail type typically called All Fighters, which is really "all fighters and bombers". (All player-facing retail naming remains as default.) My experience as a player suggests that these new options will be extremely useful.

@wookieejedi wookieejedi added this to the Release 27.0 milestone Sep 11, 2026
@wookieejedi wookieejedi added ai A feature or issue related to the AI algorithms HUD A feature or issue related to the HUD labels Sep 11, 2026
@wookieejedi wookieejedi changed the title 7721 update Comm order types modder-configurable (take 2) Sep 11, 2026

@dustinspace217 dustinspace217 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up. Against your #7721 review, 11 of the 12 points look addressed; the one I can't see is the extra whitespace (there's still a double blank line before hud_init_comm_orders, hudsquadmsg.cpp:180). Items 1, 2 and 4 are side effects of the mixed-wing fix (your point 3):

  1. The fighters-only and bombers-only flavors skip the wing pass (hudsquadmsg.cpp:1053), so Depart sets only the ship flag (1400) and never Wing_Flags::Departure_ordered (1660), and a multi-wave bomber wing still sends its next wave (ship.cpp:8803). Could wings whose present members all match still go through the wing path, with per-ship orders only for mixed wings?
  2. Per-ship orders get priority 100 against 95 for wing orders, so a later wing order should lose to an earlier "All Fighters only" one (aigoals.cpp:2318). I'm guessing the new same-priority ai_profiles flag is for that; could the description and docs say so? Item 1 would also avoid it for whole wings.
  3. Worth listing in the description: the retail All Fighters submenu no longer counts the player's ship, so its "(*)" marks change in retail missions; the per-ship pass now skips the ordering ship and Instructor ships; Abort Rearm is hidden under the Hide option. They all look like reasonable changes.
  4. In co-op, if every matching ship is human-flown, no order history gets written (1144), so query-orders "<all bombers>" stays false. Recording history separately from picking the ship that replies would fix it, and skipping No_builtin_messages ships there would keep a silenced ship from eating the reply.
  5. Is $Available squad orders: meant as a menu layout or a rule? Voice doesn't check it ("All Fighters" by voice always means fighters and bombers). If it's layout, a doc line is enough.
  6. Version 64 is also in my #7947. Since 26.2 is already in RC, whichever of us lands second should take master's next unreleased number at rebase time.

Smaller: a +Text: of 256+ bytes is fatal in the comms gauge (truncate or warn at parse), enum class for the two new enums, a trailing space at 2221, and a few tests in test_mod_table.cpp would be welcome. I haven't playtested the comm menu or multiplayer yet.

Drop the double blank line before hud_init_comm_orders and a trailing space after the small craft switch.
Read +Text: into a buffer the size of the comms gauge line buffer, so text that would not fit is truncated with the parser's usual "Token too long" warning instead of failing the copy in the gauge.
The menu item and network packet fields stay ints, so values are cast where they cross into those fields. No behavior change.
…nly orders

A wing whose present members all match the flavor now gets a wing order, so Depart marks the wing as ordered out and later waves stay home, and the reply and order history work as for All Fighters. Only wings with both matching and non-matching members are still ordered ship by ship.
The history entry is now written once the order reaches any ship, so query-orders works when every matching ship is human-flown. The ship that replies is still chosen separately, and now also skips ships that have built-in messages turned off.
For fighters-only and bombers-only orders, a wing whose members all match but that the wing pass skips (its cached leader class or the leader's accepted orders say no) now gets per-ship orders instead of none; the full fighters-and-bombers order still leaves wing members to the wing pass, as retail does. The history update returns if an order hook emptied the history, and the gauge's text limit uses the shared constant.
… orders

Those orders already checked every present member, and the cached class can be stale after a class change on a later leader; skipping it lets such a wing take the order, and a Depart, as a wing.
@dustinspace217

Copy link
Copy Markdown
Contributor

I merged master in (three conflicts, all both-sides additions next to master's new flags) and pushed the points from my review as commits, one per point plus two follow-up fixes to points 4 and 5:

  • whitespace;
  • a +Text: of 256 bytes or more is cut to 255 at parse time with the parser's usual warning, instead of a fatal error
    when the gauge draws it;
  • enum class for the two new enums;
  • fighters-only and bombers-only orders send a wing whose present members all match through the wing path, like All
    Fighters does, so Depart sets the wing's departure flag; mixed wings still get per-ship orders for the matching ships,
    and a wing the wing pass skips (for example, its leader won't take the order) falls back to per-ship orders;
  • the order history is written once whenever anyone received the order, and the ship that replies skips players and silenced ships; hud_update_last_order now returns if an order hook emptied the history first.

Things this changes that are worth knowing:

  • A silenced loose fighter no longer swallows the All Fighters reply in retail missions; another ship answers.
  • If the player's own wing is all bombers, All Bombers now goes to that wing as a wing order, the same as All Fighters
    does today. Your version ordered the matching wingmates one by one and skipped the player's own ship.
  • Every ship or wing that receives the order now updates the history entry, so its target can be filled where master left it empty.
  • A wing-level Depart also covers later waves, whose members weren't checked. Retail's leader rule has the same shape.

Tested on Linux (Debug, OpenGL, retail plus MediaVPs 5.0.3, a small test mod that turns on the narrower orders), this
head against your branch with master merged: SM1-05 with Alpha all Ursas, All Bombers > Engage goes to wing Alpha
(yours: Alpha 2 and Alpha 3 one by one); with only Alpha 2 an Ursa, both builds order just Alpha 2; plain All Fighters
matches master; two loose Ursas with the first silenced, the second now replies (yours: no reply). query-orders was true in every order-routing case. Release and Debug build without warnings and the unit tests pass. Not tested: Vulkan, co-op, and the
voice-recognition file, which only builds on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai A feature or issue related to the AI algorithms HUD A feature or issue related to the HUD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants