triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.35k stars 399 forks source link

Duplicate map names killing bots on launch #7005

Closed DanVanAtta closed 4 years ago

DanVanAtta commented 4 years ago

How can the problem be recreated?

Two examples:

Jul 02 01:44:21 li1383-13 run_server[876213]: java.lang.IllegalStateException: Duplicate key D-Day 2 (attempted merging values jar:file:/home/bot/maps/d-day2-master.zip!/d-day2-master/map/games/D-Day_2.xml and jar:file:/home/bot/maps/d-day-master.zip!/d-day-master/map/games/D-Day_2.xml)

Jul 02 01:48:18 li1383-13 run_server[876800]: java.lang.IllegalStateException: Duplicate key World War II Revised (attempted merging values jar:file:/home/bot/maps/world_war_ii_revised_variations-master.zip!/world_war_ii_revised_variations-master/map/games/ww2v2.xml and jar:file:/home/bot/maps/world_war_ii_revised-master.zip!/world_war_ii_revised-master/map/games/ww2v2.xml)

Do you have any ideas for an expected fix?

Attach a Save Game

If playing a prerelease, which version are you using?

Game Version: 2.0.20333

If playing a prerelease, does this happen on the latest release?

Is there anything else we should know?

Temporary remedy has been to remove the offending map. After next merge travis is likely to re-download all missing maps, at which point a restart will be a poison pill operation.

Cernelius commented 4 years ago

By "map names" do you mean "game file names", that are the names of the XML files within the "games" folder of the map (each of which is not necessarily the same as the name of the given game, that is defined within the file itself) or do you mean the names of the games (determined within the game files), as you see them in the "Select a Game" list, after clicking on "Select Map"?

tvleavitt commented 4 years ago

I believe, from reading the text of the included error messages, that if you have two zip files ("games" from a map-maker perspective) with an XML file of the same name in them (which I believe is a "map", not a "game"), then you will get this error. I'm guessing that somehow the XML filenames are read into a "key/value" hash table, and this is generating collisions.

The two "Maps" (as in Downloads, which are really "Games", I believe, from a map-maker perspective) exhibiting this problem are d-day2-master.zip and d-day-master.zip, both of which contain an XML file of the name "D-Day_2.xml", and world_war_ii_revised_variations-master.zip and world_war_ii_revised-master.zip, both of which contain an XML file of the name ww2v2.xml. This is logically happening with closely related "Games" that were likely "cloned" from one another, but could easily happen completely accidentally, say if two authors decided to create an XML file named, "WorldAtWar.xml" or "warringstates.xml", or "capturetheflag.xml".

Thomas

On Thu, Jul 9, 2020 at 10:55 AM Cernelius notifications@github.com wrote:

By "map names" do you mean "game file names", that are the names of the XML files within the "games" folder of the map (each of which is not necessarily the same as the name of the given game, that is defined within the file itself) or do you mean the names of the games (determined within the game files), as you see them in the "Select a Game" list, after clicking on "Select Map"?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/triplea-game/triplea/issues/7005#issuecomment-656267544, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB5HAIQYR24KMF5IHNKNQTR2YAA5ANCNFSM4OOMEZIA .

-- Thomas Leavitt Internet enabled since 1990

Cernelius commented 4 years ago

Ok, terminology aside (@tvleavitt the "map" folder you download is the map and, as far as I know, it has always officially be known as such, if it is not a mapskin and since skin-less maps (practically, collections of mods) have ceased being offered (since after GitHub times, the map is inside another "master" folder, but the old format is still supported too)), if what @tvleavitt says is correct (summarizing, the problem is that the "games" folder's XML file names are the same), I think the problems here are twice and partially different, and are mainly problems at a map level. We can say that, if in the past this was not a problem for the program, then the program had the problem of ignoring such problems.


d-day2-master.zip and d-day-master.zip, both of which contain an XML file of the name "D-Day_2.xml"

In this case, also the game names are the same, specifically, as you can see in the Select a Game window you get two games both called "D-Day 2":

D-Day 2

Map Name: d-day2 Number Of Players: 6 Location: jar:file:/C:/Users/.../triplea/downloadedMaps/d-day2-master.zip!/d-day2-master/map/games/D-Day_2.xml Version: 2.2.0

And:

D-Day 2

Map Name: d-day Number Of Players: 5 Location: jar:file:/C:/Users/.../triplea/downloadedMaps/d-day-master.zip!/d-day-master/map/games/D-Day_2.xml Version: 2.1.0

These games are both offered as "D-Day 2" in the "Games" list. This is very confusing also since, by reading through the notes for a few minutes, I've no idea what is even the difference between the two games or how any user is supposed to decide which one to pick amongst the two. It seems that there is the "d-day" map that offers what is probably, or at least assumingly, the main "D-Day" game and it also offers a modification of it called "D-Day 2". Then, there is another map called "d-day2" that offers another game called "D-Day 2". It would be good, here, to know what is the difference between the two "D-Day 2" games and if one of the two can be renamed or even deleted. In my opinion, TripleA should not accept game names that are exactly the same as existent ones, for the sake of avoiding confusion. I would suggest the main developer to make a rule that once a name is taken for a game, nobody else can have it too. If this rule would be made, then the newest one of these games should be the one to be renamed or removed, unless it can be demonstrated that the old one should better be removed (as being inferior, for some reasons). @ZjelcoP I see you are credited in both games. Why did you make both a game modification of the "D-Day" game within the "d-day" map and a map modification of the "d-day" map having its game called the same way as the aforementioned game modification, if my understanding is correct? Was one of the two supposed to be eventually deleted in favour of the other one? The first difference that I see is that the game of the map modification (the "d-day2" map) has a higher game version and a number of players equal to 6, while the game modification (within the "d-day" map) has a lower game version and a number of players equal to 5. Is maybe the "D-Day 2" game of the "d-day2" map simply the "successor" of the "D-Day 2" game of the "d-day" map? Would it be advisable to delete the older one (usually old versions are not kept around, otherwise you would have tens of games for each of several maps)?


world_war_ii_revised_variations-master.zip and world_war_ii_revised-master.zip, both of which contain an XML file of the name ww2v2.xml.

This looks like a simple and obvious case. The game in the "world_war_ii_revised" map is the well known "World War II Revised" game, as you can see in the Select a Game window:

World War II Revised

Map Name: world_war_ii_revised Number Of Players: 5 Location: jar:file:/C:/Users/.../triplea/downloadedMaps/world_war_ii_revised_variations-master.zip!/world_war_ii_revised_variations-master/map/games/ww2v2.xml Version: 1.4.1

And the game of the "world_war_ii_revised_variations" map appears to be simply a duplicate of the same, I surmise inadvertently duplicated.

Here the obvious solution seems just to delete this file: world_war_ii_revised_variations/map/games/ww2v2.xml

However, now this raises the question why am I not seeing two "World War II Revised" games in my "Games" list in the "Select a Game" window, like it happens, instead, for the two "D-Day 2" games? I think this should be indagated, as I cannot find an answer to this question.


While looking into this, I have to report that there is at least a third case, as the "world_war_ii_revised" and "world_war_ii_revised_variations" maps are both also offering what appears to be the same "World War II Revised LHTR" game, as the same named "lhtr.xml" file within each of their "games" folders.

However, now this also raises the question why is this not giving the error that the "ww2v2.xml" files are giving, instead, if it isn't?

Here the obvious solution seems just to delete this file: world_war_ii_revised_variations/map/games/lhtr.xml

Side note, I suggest renaming the "lhtr.xml" file to something like "ww2v2_lhtr.xml".

DanVanAtta commented 4 years ago

Thanks for the analysis @Cernelius

One problem is we can't enforce globally unique game names very easily. Map makers can push any XMLs they please

DanVanAtta commented 4 years ago

A PR is up that will prevent the bots from crashing. So we have a technical mitigation. Let's use issue #7089 to discuss fixing the map repos to have unique names and discuss a long-term strategy.