Opened 5 years ago
Closed 5 years ago
#5558 closed defect (fixed)
Duplicate medit_city_tile terrain detected by Checkrefs.pl
Reported by: | Stan | Owned by: | Stan |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 24 |
Component: | Core engine | Keywords: | |
Cc: | Patch: |
Description
Currently when running the checkrefs.pl script, one gets the following error:
Duplicate terrain name 'medit_city_tile' (from 'art/terrains/biome-mediterranean/medit_city_tile.xml' and 'art/terrains/road/medit_city_tile.xml')
Both files were added in r12306
The PMP format doesn't care about paths, so for him only the first texture matters, the other one gets replaced by the first when placed in the editor. Only the preview is correct, I believe it's because it is loaded differently.
The following maps use 'medit_city_tile' (used by writing a small c# code that parsed all the PMP files)
binaries/data/mods/public/maps/scenarios/Arcadia.pmp binaries/data/mods/public/maps/scenarios/Battle for the Tiber.pmp binaries/data/mods/public/maps/scenarios/Bridge_demo.pmp binaries/data/mods/public/maps/scenarios/Campaign Test Map.pmp binaries/data/mods/public/maps/scenarios/Miletus.pmp binaries/data/mods/public/maps/scenarios/Multiplayer_demo.pmp binaries/data/mods/public/maps/scenarios/Peloponnese.pmp binaries/data/mods/public/maps/scenarios/Sandbox - Iberians.pmp binaries/data/mods/public/maps/scenarios/Sandbox - Macedonians.pmp binaries/data/mods/public/maps/scenarios/Territory Demo.pmp binaries/data/mods/public/maps/scenarios/The Massacre of Delphi.pmp binaries/data/mods/public/maps/scenarios/Third Macedonian War.pmp binaries/data/mods/public/maps/skirmishes/Acropolis Bay (2).pmp binaries/data/mods/public/maps/skirmishes/Corinthian Isthmus (2).pmp binaries/data/mods/public/maps/skirmishes/Corinthian Isthmus (4).pmp binaries/data/mods/public/maps/skirmishes/Corsica and Sardinia (4).pmp binaries/data/mods/public/maps/skirmishes/Egypt (3v3).pmp binaries/data/mods/public/maps/skirmishes/Greek Acropolis (2).pmp binaries/data/mods/public/maps/skirmishes/Greek Acropolis (4).pmp binaries/data/mods/public/maps/skirmishes/Greek Acropolis Night (2).pmp binaries/data/mods/public/maps/skirmishes/Sicilia (2).pmp binaries/data/mods/public/maps/skirmishes/Sicilia_Nomad.pmp binaries/data/mods/public/maps/skirmishes/Skirmish Demo.pmp binaries/data/mods/public/maps/tutorials/Introductory_Tutorial.pmp
binaries/data/mods/public/maps/random/atlas_mountains.js binaries/data/mods/public/maps/random/corsica.js binaries/data/mods/public/maps/random/cycladic_archipelago.js binaries/data/mods/public/maps/random/guadalquivir_river.js binaries/data/mods/public/maps/random/hellas_biomes.js binaries/data/mods/public/maps/random/latium.js binaries/data/mods/public/maps/random/mediterranean.js
SOLUTION 1 :
- Rename terrains/roads/medit_city_tile.xml to medit_city_road.xml and the subsequent textures
- Add missing textures <texture name="normTex" file="types/medit_city_tile_2_norm.png"/> <texture name="specTex" file="types/medit_city_tile_2_spec.png"/>
- Update material to make use of those.
Pros:
- Easy
- Few files to edit.
Cons:
- Workaround solution
SOLUTION 2 :
- Switch the two file contents
- Add missing textures <texture name="normTex" file="types/medit_city_tile_2_norm.png"/> <texture name="specTex" file="types/medit_city_tile_2_spec.png"/>
- Update material to make use of those.
- Rename terrains/roads/medit_city_tile.xml to medit_city_road.xml and the subsequent textures
- Replace the texture in every map either by editing the pmp header, or by opening and replacing the texture with the replace tool in atlas, and editing the js file.
Pros:
- Clean solution
Cons :
- 29 Files to edit
Change History (4)
comment:1 by , 5 years ago
Summary: | Duplicate terrain name in Checkrefs.pl → Duplicate medit_city_tile terrain detected by Checkrefs.pl |
---|
comment:2 by , 5 years ago
(no grep / string search in binary files for windows?)
I believe that find only works for text files. I can upload the script on demand as well, it's .Net Core so it's cross platform.
If we open the PMP file with a hex editor and search for "medit", we see that paths aren't saved there, only the filename. Random map scripts specify only the filename, excluding the foldername. Took a brief look at MapWriter?.cpp, but didn't immediately find the place where the path is cut off. If it is true that the path is entirely irrelevant to maps, then we don't have to edit any map to delete the duplicate, do we?
The atlas editor also shows only one copy, in the roads category.
Firstly one should check where it was supposed to be (workload only as a tiebreaker if the two alternatives are equal).
We wouldn't if the name tile wasn't incorrect. the current one displayed is more a road with uneven rocks than a tiled floor, the one in road however is. If you look at the preview they are different. the textures also are for that matter. I believe the preview is derived it.
Forgot to link it but https://trac.wildfiregames.com/wiki/PMP_File_Format has some more informations on the binary format of the maps
So, if there is a roads category, why wouldn't all roads be in it?
- Alpine has 0 road types
- Desert has 4 road types
- Mediterranean has 1 road tpye
- Polar 0
- Savanna maybe 1
- Steppe 0
- Temperate 3 (+3 duplicates)
- Tropic 0
One can also specify in what category the file goes using the groups tag (eg. in medit_city_tile)
<props groups="city" movementclass="city" mmap="230 227 198" angle="45.0" size="18.0"/>
Then there is the "City" category which contains tiles that also look like roads.
So it seems a bit arbitrary given that Road, City and biome categories are, apparently, not well sorted out.
What do the design documents say on these categories? I couldn't find anything from a brief search.
I saw nothing in the Art Document either, I guess they weren't problematic to create a naming rule at the time.
"Medit city pavement" from the medit biome and "medit city tile dirt" from Roads have the same structure but different colors.
"medit city tile" in Roads indeed has the wrong preview thumbnail - or it rather shows the right one but the map uses the wrong file. That's kind of a bug. All of this seems to be a bug because if it would check for folders, the issue wouldn't happen to begin with.
If we look at the XML file, we see the biome one using medit_city_tile.dds and the other using medit_city_tile_2.dds. So it looks like the latter can only be seen in the atlas thumbnail, so it's a lost texture. It's there but noone can use it. It should be renamed, instead of deleted.
The plan behind this ticket was not to delete it, but to make it work again, rename it and or move it to the correct folder, and use the two png textures that it should use.
So looking at your two solutions, the former one seems ok, why is it a workaround?
Because the one named tile is not technically a tiled texture, it' a rocky road texture. and the one in roads is indeed tiled.
comment:3 by , 5 years ago
Milestone: | Backlog → Alpha 24 |
---|
(no grep / string search in binary files for windows?)
If we open the PMP file with a hex editor and search for "medit", we see that paths aren't saved there, only the filename. Random map scripts specify only the filename, excluding the foldername. Took a brief look at MapWriter.cpp, but didn't immediately find the place where the path is cut off. If it is true that the path is entirely irrelevant to maps, then we don't have to edit any map to delete the duplicate, do we?
The atlas editor also shows only one copy, in the roads category.
Firstly one should check where it was supposed to be (workload only as a tiebreaker if the two alternatives are equal).
So, if there is a roads category, why wouldn't all roads be in it?
Then there is the "City" category which contains tiles that also look like roads.
So it seems a bit arbitrary given that Road, City and biome categories are, apparently, not well sorted out.
What do the design documents say on these categories? I couldn't find anything from a brief search.
"Medit city pavement" from the medit biome and "medit city tile dirt" from Roads have the same structure but different colors.
"medit city tile" in Roads indeed has the wrong preview thumbnail - or it rather shows the right one but the map uses the wrong file. That's kind of a bug. All of this seems to be a bug because if it would check for folders, the issue wouldn't happen to begin with.
If we look at the XML file, we see the biome one using
medit_city_tile.dds
and the other usingmedit_city_tile_2.dds
.So it looks like the latter can only be seen in the atlas thumbnail, so it's a lost texture. It's there but noone can use it. It should be renamed, instead of deleted.
Since "Medit city tile" and "Medit city tile dirt" in the road category are differently colored variants, they should remain grouped. So either both or none of them would be moved, moving none of them sounds preferable because there is no strong reason to move them.
"Medit city pavement" however is also a variant of those two textures, so it should be grouped with them.
The Road category contains some biome roads, so unless we want to nuke or significantly empty that category, it doesnt sound wrong to me to move
Medit city pavement
over to Road, and rename the duplicate tilename.Also it makes no sense that one of them is called "pavement" but the others arent't. The three variants could be named according the thier color.
So looking at your two solutions, the former one seems ok, why is it a workaround?
medit/"medit city pavement" could be roads/"medit city tile white" roads/"medit city tile" could be roads/"medit city tile gray" roads/"medit city tile dirt" could be roads/"medit city tile beige"
But I suppose we want to avoid messing with PMP files.
So I'm ok with having roads/"medit city tile" renamed to roads/"medit city teletubby" or similar.