HomeWildfire Games

Gamesetup class rewrite, fixes #5322, refs #5387.
AuditedrP23374

Description

Gamesetup class rewrite, fixes #5322, refs #5387.

  • Decouples settings logically which in turn allows fixing many problems arising from previous coupling.
  • Fixes the persist-match-settings feature, refs #2963, refs #3049.
  • Improves performance of the matchsetup by rebuilding GUI objects only when necessary.

Provides groundwork for:

  • UI to control per-player handicap, such as StartingResources, PopulationCap, StartingTechnologies, DisabledTechnologies, DisabledTemplates, ..., refs #812.
  • Map specific settings (onMapChange event), refs #4838.
  • Chat notifications announcing which settings changed, refs D1195,
  • Multiple controllers setting up the game (since setting types can check for permissions in onUpdateGameAttributes without the need for a new data model or a second gamesetup data network message type), refs #3806, subsequently dedicated server, refs #3556.
  • MapBrowser (MapCache, MapTypes, onUpdateGameAttributes interface), refs D1703 and D1777,
  • Multiplayer saved games (decoupling and setting dependent unique logic), refs #1088.

Refs https://wildfiregames.com/forum/index.php?/topic/20787-paid-development-2016/ https://wildfiregames.com/forum/index.php?/topic/20789-paid-development-2016/

Enable maps to restrict setting values:

  • If a map specifies an AI or Civs for a playerslot, the controller can't assign a player/other AI or Civ to that slot, refs #3049, #3013.

Fix per player StartingResources, PopulationCap, StartingTechnologies, DisabledTechnologies, DisabledTemplates following rP12756, refs #812, fixes #4504. Use this for DisabledTechnologies on Polar Sea.

Persist user settings for Skirmish maps:

  • All user chosen settings are persisted when changing the selected map or maptype, except where the selected map overwrites the setting value and except for Scenario maps which still use the default value where the map doesn't specify the setting value.
  • Tickets relating to that Skirmish mapchange user setting persistance:
    • Selecting a map doesn't change the selected civilizations, fixes #3120 (together with r23279 removing map specified Civs).
    • Selecting a map type doesn't reset the selected settings, fixes #5372.
    • Selecting a map doesn't change the selected victory conditions, unless the map specifies those, refs #4661, #3209. (Atlas still writes VictoryConditions to every map.)
    • Consume the player color palette from Skirmish maps, refs rP17040 / #1580. Preserve the selected playercolors when switching the Skirmish/Random map by chosing the most similar colors if the map comes with a different palette.

Rated games:

  • Hide and disable Rated game setting unless there are exactly two players, fixes #3950, supersedes D2117.
  • Display conspicuous warning if the game is rated, so players are perfectly aware.

Autostarted games:

  • Allow using the gamesetup page to autostart matches with arbitrary maps, not only this one tutorial, as reported in D194 and rP19599, refs D11.

Networking:

  • Keep gamesetup page open after disconnect, allowing players to read chat messages indicating why the host stopped the server, fixes #4114.
  • The message subscription system allows new and mod settings to run custom logic on arbitrary setting changes (most importantly on map change). This removes hardcoded logic restrictions from the gamesetup option unification rewrite in rP19504/D322, refs #3994, such as the hardcoding of setting references in selectMap to biomes from rP20115/D852 and the difficulty from rP20760/D1189, RelicDuration, WonderDuration, LastManStanding, RegicideGarrison, TriggerScripts, CircularMap, Garrison, DisabledTemplates.

Checkboxes:

  • Display values of disabled checkboxes with Yes/No labels, fixes D2349, reviewed by nani.

Clean g_GameAttributes of invalid values and gamesetup GUI temporaries, refs #3049, #3883:

  • Delete useless values:
    • VictoryScripts, because they are redundant with TriggerScripts, introduced in rP15427.
    • mapType which was written twice to g_GameAttributes following rP12756
    • Description, Keywords, Preview since that doesn't impact simulation and can be loaded from the MapCache
    • mapFilter, mapPath, SupportedBiomes, SupportedTriggerDifficulties since they are only used in the gamesetup
  • Delete conditional values if the condition is not met:
    • AIDiff, AIBehavior if there is no AI in that slot
    • Nomad and Size if the maptype is not Random
    • Biome, TriggerDifficulty if the map doesn't support that
    • WonderDuration, RegicideGarrison, RelicCount, RelicDuration if the according VictoryConditions are not enabled
    • LastManStanding if TeamsLocked
    • Rating if there are more than 2 players

MapCache:

  • Refactor to MapCache class, store maps of all types and use it in the replaymenu, lobby and session as well.

SettingTabsPanel:

  • Remove hardcodings and coupling of the SettingTabsPanel with biomes/difficulties/chat UI from D1027/rP20945.

GamesetupPage.xml:

  • Restructure the page to use hierarchical object organization (topPanel, centerPanel, centerLeftPanel, bottomPanel, centerCenterPanel, centerRightPanel, bottomLeftPanel, bottomRightPanel), allowing to deduplicate object position margins and size math and ease navigation.

New defaults:

  • Check LockedTeams default in multiplayer (not only rated games).
  • Persist the rated game setting instead of defaulting to true when restarting a match, which often lead to unintentional rated games when rehosting.
  • 60 FPS in menus since they are animated

Autocomplete sorting fixed (playernames should be completed first).
Refactoring encompasses the one proposed in Polakrity and bb D1651.

Differential Revision: https://code.wildfiregames.com/D2483
Tested by: nani
Discussed with:

Emojis by: asterix, Imarok, fpre, nani, Krinkle, Stan, Angen, Freagarach

Event Timeline

bb raised a concern with this commit.Jan 14 2020, 12:26 PM

On min res: enable both relics and regicide. Not all options are visible

This commit now has outstanding concerns.Jan 14 2020, 12:26 PM
elexis requested verification of this commit.Jan 15 2020, 12:52 PM
This commit now requires verification by auditors.Jan 15 2020, 12:52 PM
bb accepted this commit.Jan 21 2020, 4:54 PM

Reported bug has been fixed, one can notice that the animation changed in the case when switching from 2 to 1 tab (there now is a gap between the panelButtons and the settingsPanel). New version fine with me too

All concerns with this commit have now been addressed.Jan 21 2020, 4:54 PM
Silier added a subscriber: Silier.Mar 23 2020, 10:01 PM
Silier added inline comments.
/ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientConnection.js
21

username was colorised in a23b

/ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientReady.js
22

reported by nani that username was colorised in a23b

When having more than 1000 FPS, the menu panel is not animated anymore (millisecond delta = 0), reported by OptimusShepard on
http://irclogs.wildfiregames.com/2020-05/2020-05-03-QuakeNet-%230ad-dev.log

Silier added inline comments.Aug 26 2020, 11:50 AM
/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapFilter.js
47

values.Name does not have to exist, when there is no map in folder

Silier raised a concern with this commit.Aug 27 2020, 8:12 AM
Silier added inline comments.
/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicDuration.js
24

this does not work if map specifies 0

This commit now has outstanding concerns.Aug 27 2020, 8:12 AM

found more

/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RevealedMap.js
8

Q: does this need || undefined ? RegicideGarrison e.g. and others

/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Ceasefire.js
18

0 ceasfire by map is broken but one could argue it is like not having it at all so meh?
It is to consider, if one wants to specify 0 in map, should be able to do so ;)

/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicCount.js
23

Note: 0 relics would be weird with capture_the_relic condition so mostly ok

/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/StartingResources.js
30

Dont know if possible, but, if map tells 0, it fails here

/ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/WonderDuration.js
24

wonder duration 0 by map is broken

Silier accepted this commit.Sep 11 2020, 9:25 PM
All concerns with this commit have now been addressed.Sep 11 2020, 9:25 PM