Page MenuHomeWildfire Games

Always display RatedGame boolean
AbandonedPublic

Authored by elexis on Jun 26 2017, 10:26 PM.

Details

Reviewers
bb
Summary

It is often not obvious whether the currently played 1v1 multiplayer game is rated or not. The objectives dialog should always display that to eliminate any doubt.
Notice that we don't have a nice way to distinguish single- and multiplayergames and replays of lobby and non-lobby multiplayer games.

Hence just always show that setting for 1v1 games in replays and lobby games
(thus hide it in single and non-lobby multiplayer games but still show it in replays of singleplayer 1v1s etc.)

Also it should be the topmost element, because if it can be set, it will be the most important boolean of the match.

Notice the previous 1v1 test was broken, because skirmish maps (can?) add a null gaia PlayerData entry. So while at it, also test for AIs.

Test Plan

Make sure the front doesn't fall off.

Event Timeline

elexis created this revision.Jun 26 2017, 10:26 PM
Vulcan added a subscriber: Vulcan.Jun 26 2017, 10:47 PM
Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/gui/common/gamedescription.js
| 402| »   »   "label":·"[color=\""·+·g_DescriptionHighlight·+·"\"]"·+·title.label·+·":"·+·"[/color]",
|    | [NORMAL] ESLintBear (no-useless-concat):
|    | Unexpected string concatenation of literals.

binaries/data/mods/public/gui/common/gamedescription.js
|  89| »   »   if·(playerData·==·null·||·playerData.Civ·&&·playerData.Civ·==·"gaia")
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with 'null'.

binaries/data/mods/public/gui/common/gamedescription.js
|  94| »   »   let·isAI·=·playerData.AI·&&·playerData.AI·!=·"";
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with ''.

binaries/data/mods/public/gui/common/gamedescription.js
| 317| »   »   »   »   g_GameAttributes.settings.Ceasefire·==·0·?
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/242/ for more details.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1635/ for more details.

bb requested changes to this revision.Aug 8 2017, 12:38 PM
bb added a subscriber: bb.

Front falls of when assigning an unassigned player in SP, and the string is wrong in MP, also the code doesn't seem to care about a 2vn with n ai (or a 1v1v ai v ai ...), nor a 2v0. Notice these things are also wrong in replay menu. (the lobby score won't be addapted since there is only 1 player's report)

This revision now requires changes to proceed.Aug 8 2017, 12:38 PM
elexis added a comment.Aug 8 2017, 3:20 PM
In D682#30463, @bb wrote:

Front falls of when assigning an unassigned player in SP

Front falls off in the gamesetup for 2 players.

the string is wrong in MP

huh?
You mean replay I guess.

also the code doesn't seem to care about a 2vn with n ai (or a 1v1v ai v ai ...), nor a 2v0

It does care about 2vn as it checks for exactly 2 players.
The 2v0 and 1vAI case is not considered.
Don't feel like adding the inattractive code for that case, would you agree?
Wouldn't we also have to add lots of strings explaining why this particular game isn't rated?

			g_GameAttributes.settings.RatingEnabled &&
			g_GameAttributes.settings.PlayerData.length == 3 &&
			g_GameAttributes.settings.PlayerData.every(pData => !pData || !pData.AI) &&
			(g_GameAttributes.settings.PlayerData[1].Team == -1 ||
			 g_GameAttributes.settings.PlayerData[1].Team != g_GameAttributes.settings.PlayerData[2].Team) ?

And that still doesn't account for unassigned players. We'd have to iterate through the player assignments, which will be just as long, so meh.

Should rather provide an explanation in the lobby which games are rated exactly and disable teams if the game is rated.

Notice these things are also wrong in replay menu.

It's (and always has been) wrong in the gamesetup, as we can enable the rated game for a 4v4.

We should probably still show the "Unrated game" string for numplayers > 2 though.

elexis updated this revision to Diff 3047.Aug 8 2017, 3:26 PM
elexis edited edge metadata.

Fix undefined replay variable in the gamesetup (fruits of changing the code after testing it),
Use past tense for the replays.
Simplify playercount check.

Vulcan added a comment.Aug 8 2017, 9:31 PM
Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/gui/common/gamedescription.js
| 406| »   »   "label":·"[color=\""·+·g_DescriptionHighlight·+·"\"]"·+·title.label·+·":"·+·"[/color]",
|    | [NORMAL] ESLintBear (no-useless-concat):
|    | Unexpected string concatenation of literals.

binaries/data/mods/public/gui/common/gamedescription.js
|  89| »   »   if·(playerData·==·null·||·playerData.Civ·&&·playerData.Civ·==·"gaia")
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with 'null'.

binaries/data/mods/public/gui/common/gamedescription.js
|  94| »   »   let·isAI·=·playerData.AI·&&·playerData.AI·!=·"";
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with ''.

binaries/data/mods/public/gui/common/gamedescription.js
| 321| »   »   »   »   g_GameAttributes.settings.Ceasefire·==·0·?
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.

binaries/data/mods/public/gui/session/menu.js
| 440| »   »   button.onPress·=·(function(player,·stance)·{·return·function()·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'stance' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 472| »   »   button.onPress·=·(function(i,·resCode,·button)·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 472| »   »   button.onPress·=·(function(i,·resCode,·button)·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'resCode' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 472| »   »   button.onPress·=·(function(i,·resCode,·button)·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'button' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 515| »   button.onPress·=·(function(i)·{·return·function()·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 571| »   button.onPress·=·(function(i)·{·return·function()·{
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/menu.js
| 382| »   »   let·hasAllies·=·g_Players.filter(player·=>·player.isMutualAlly[g_ViewedPlayer]).length·>·1;
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
| 440| »   »   button.onPress·=·(function(player,·stance)·{·return·function()·{
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
| 472| »   »   button.onPress·=·(function(i,·resCode,·button)·{
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
| 612| »   »   »   button[res].up.hidden·=·!controlsPlayer(g_ViewedPlayer)·||·res·==·currTradeSelection·||·proba[res]·==·100·||·proba[currTradeSelection]·==·0;
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.

binaries/data/mods/public/gui/session/menu.js
| 613| »   »   »   button[res].dn.hidden·=·!controlsPlayer(g_ViewedPlayer)·||·res·==·currTradeSelection·||·proba[res]·==·0·||·proba[currTradeSelection]·==·100;
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.

binaries/data/mods/public/gui/session/menu.js
| 662| »   »   buttonResource.onPress·=·(resource·=>·{
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
| 677| »   »   buttonUp.onPress·=·(resource·=>·{
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
| 687| »   »   buttonDn.onPress·=·(resource·=>·{
|    | [NORMAL] JSHintBear:
|    | Don't make functions within a loop.

binaries/data/mods/public/gui/session/menu.js
|1017| »   »   »   »   g_IsObserver·||·player·==·0·||·player·==·g_ViewedPlayer·||
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/367/ for more details.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1820/ for more details.

elexis planned changes to this revision.Aug 9 2017, 8:19 PM

The strings lie when they say that a match vs an AI will result in a lobby rating.
We'd have to distinguish the unassigned from the offline player (and the offline player flag seems to be broken when rejoining a game where someone is offline).

binaries/data/mods/public/gui/common/gamedescription.js
226

The filtering of the gaia null in the playerData array was needed as long as we have that in the session but on in the gamesetup.