Page MenuHomeWildfire Games

avoid suggesting non-functional actions for Gaia entities
Needs ReviewPublic

Authored by abian on Oct 6 2023, 8:14 PM.

Details

Reviewers
phosit
Trac Tickets
#6853
Summary

A few non-functional actions are suggested in the left and right panels of the GUI for Gaia entities. These suggestions sometimes cause warnings and errors (#6853) because Gaia is not a civilization and has no phases, technologies or specific units. This patch ensures that only (a) functional suggestions or (b) suggestions with informative value are provided. Examples of non-functional suggestions with informative value include stances (although the stance of a unit owned by Gaia cannot be changed, the panel informs what the current stance is) and formations (the panel reports the current formation of a set of units, if any). This patch also avoids displaying the left or right panels in certain cases where they were completely empty.

Test Plan

Test 1:

  1. Start a game and select a builder. The right panel shows the build options as usual.
  2. Resign and stay in the game. Select the same builder. Now the right panel does not show any build option.

Test 2 (thanks to phosit):

  1. Start a game with ./binaries/system/pyrogenesis -autostart="random/danubius" -autostart-player=-1.
  2. Check that non-functional and non-informative suggestions are not displayed, while functional or informative suggestions are still displayed.

Event Timeline

abian created this revision.Oct 6 2023, 8:14 PM
Vulcan added a comment.Oct 6 2023, 8:15 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7371/display/redirect

Vulcan added a comment.Oct 6 2023, 8:18 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8460/display/redirect

abian requested review of this revision.Oct 6 2023, 8:28 PM
sera added a subscriber: sera.Oct 6 2023, 10:20 PM

A gaia unit that wasn't owned by a player won't show the builder panel. Seems like a case of resigning not doing proper cleanup.

Nice find as for the issue but the solution seems like a quick hack.

phosit added a subscriber: phosit.Oct 6 2023, 10:39 PM

It would be more consistent if gaia (the civ) hasn't any building, insted of gaia (the player) can't build anything.

phosit added a comment.EditedOct 6 2023, 10:43 PM
In D5151#219170, @sera wrote:

A gaia unit that wasn't owned by a player won't show the builder panel.

No, Units who spawn as gaia also show the builder panel.

sera added a comment.Oct 7 2023, 12:11 AM
In D5151#219170, @sera wrote:

A gaia unit that wasn't owned by a player won't show the builder panel.

No, Units who spawn as gaia also show the builder panel.

Try Danubis, the gaia units don't show a builder panel for me. Maybe what you checked was constructed in a way subject to no cleanup or this faulty behavior was introduced very recently.

Try Danubis, the gaia units don't show a builder panel for me.

It's reproducable this way:

  1. Start a game via this command ./binaries/system/pyrogenesis -autostart="random/danubius" -autostart-player=-1
  2. Select a gaia unit that can build.
  3. See that there is a builder panel.
sera added a comment.Oct 8 2023, 5:10 PM

Indeed I got misled by the check for the builder component and checked while having a player id to confirm my suspicion ...

The fact still remains, if there is use for a builder component for gaia units it should be in a working state (unlike now), if it's considered useless it shouldn't be created or be freed upon transition.

In D5151#219237, @sera wrote:

The fact still remains, if there is use for a builder component for gaia units it should be in a working state (unlike now), if it's considered useless it shouldn't be created or be freed upon transition.

+1

abian updated this revision to Diff 22405.Oct 12 2023, 12:34 PM
abian retitled this revision from avoid suggesting build options for Gaia units to avoid suggesting non-functional actions for Gaia entities.
abian edited the summary of this revision. (Show Details)
abian edited the test plan for this revision. (Show Details)

Thanks for your comments! I think this will do the trick.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7385/display/redirect

abian edited the summary of this revision. (Show Details)Oct 12 2023, 12:39 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8474/display/redirect

phosit added inline comments.Oct 15 2023, 5:44 PM
binaries/data/mods/public/gui/session/unit_commands.js
141–145

Did you change something in this statement?

155–160

Might use const

196–198

remove the braces.
In the other places you check only the first entity. Why do you check every entity in this case?

abian added inline comments.Oct 15 2023, 9:52 PM
binaries/data/mods/public/gui/session/unit_commands.js
141–145

No, I didn't, it's the same.

155–160

Okay, I'll change it.

196–198

Sure, thanks!
I didn't want to call GetEntityState an extra time before the loop and assumed that repeating these comparisons would be more efficient, but I haven't really tried it and don't have a strong preference for either option.

abian updated this revision to Diff 22430.Oct 15 2023, 9:54 PM
abian added a reviewer: phosit.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8485/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/7396/display/redirect

You should prefere === over ==.

binaries/data/mods/public/gui/session/unit_commands.js
141–145

Why did you change it then. It will mess up the blame output.

Also const isObserverOr... = g_IsObserver || ... feels redundant.

159

In the summary you wrote that a panel is hidden when it's empty. So it should not directly depend if the entity is owned by gaia.

196–198

I would make it consistent.
For performence reasons I would only check the first entity.