Unit's image confusion

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Unit's image confusion

Post by WhiteWolf »

Hi,

For the first time, I'm trying to write an era. I wish to use all of the units from my campaign. All units are included from "The_Ravagers" campaign, the era add-on does not contain additional units. This is the main.cfg and the era tag:
main:
era.cfg:
Now that problem is, that if f..e. Archaic Era add-on is intsalled, some of my unit's images are confused. For example, I have a units/orcs/hunter.png, and Archaic Era also has units/orcs/hunter.png, and instead of mine, the one from Archaic Era is used in the game, but the unit's other attributes are OK.
The units work perfectly in the campaign. What is causing this confusion here?

Thanks,
WhiteWolf
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Eagle_11
Posts: 759
Joined: November 20th, 2013, 12:20 pm

Re: Unit's image confusion

Post by Eagle_11 »

Is this happening on 1.13 ?
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Unit's image confusion

Post by WhiteWolf »

No, 1.12.6. It's not just one unit, every unit that has an identical image name in an installed add-on gets overridden. It's like I included those add-ons as [binary_path]'s, before the actual one. But it's not the case :hmm:
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Unit's image confusion

Post by zookeeper »

Your era adds a [binary_path], and Archaic Era and all other eras also add their [binary_path]s. If there are images with the same names and paths in several eras, then there's a conflict. The only way to avoid that is to either change your filenames and/or paths to make them unique, or to use the rarely-used explicit path style: instead of image=foo.png, use image=data/add-ons/The_Ravagers/foo.png. Technically, if one used that path style everywhere, they wouldn't need a [binary_path] at all (at least for images).

EDIT: To clarify, the reason why this problem doesn't exist in campaigns is because each campaign's [binary_path] is (or should be) isolated inside the campaign's own #ifdef MY_WHATEVER_CAMPAIGN, whereas the [binary_path]s of all multiplayer eras are all in #ifdef MULTIPLAYER.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Unit's image confusion

Post by WhiteWolf »

So I see. But in case of a conflict, what determines the primary image? Why does the archaic era image overwrite mine, and why not the other way around?
I had a naive experiment to see if it's in connection to alphabetical ordering of the names - it's not.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Unit's image confusion

Post by zookeeper »

WhiteWolf wrote:So I see. But in case of a conflict, what determines the primary image? Why does the archaic era image overwrite mine, and why not the other way around?
I'm not sure. If it's not alphabetical order, then I wouldn't be surprised if it was reverse alphabetical order.

Binary paths define the paths in which images/sounds/music are looked in, so when the game is trying to find a particular image by looking through its long list of binary paths, I'm pretty sure it just picks the first one it comes across. But what that order is exactly, or whether it might even be platform-dependant, I don't know.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Unit's image confusion

Post by WhiteWolf »

My mistake - it is alphabetical. It's the campaign I should have renamed with a starting zero to be in the first place, not the era, since that's where the images are.
The simplest solution I found is to copy all images to the era as well, rename it to 0My_era_foo, and include it into the binary path's, next to the campaign.
This however will mean that my add-on is the "more aggressive", in the long term, won't these mechanics lead to an arms race, in whose add-on is the first? I'm not sure this system is too practical. :(
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply