Sloppy use of [binary_path]s

Discussion and development of scenarios and campaigns for the game.

Moderators: Forum Moderators, Developers

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Sloppy use of [binary_path]s

Post by zookeeper » July 5th, 2006, 8:10 am

I noticed that basically all user made campaigns use [binary_path]s in a really sloppy way - one that leads to portrait collisions, for example. I just experienced that having the Sceptre of Fire installed leads to that campaign's Haldric portrait overriding TRoW's Haldric portrait.

How to use [binary_path]s properly:

Put your campaign's "main" [binary_path] (the one to the campaign's root dir, such as path=data/campaigns/Sceptre_of_Fire/) inside the #ifdef, never outside.

If you need some of your images, for example, to be globally accessible (campaign icons, difficulty level icons, etc), put them (and only them!) into a separate directory and have the [binary_path] outside your #ifdef point to that. And make sure that the files therein are named so that they don't cause collisions, by for example prefixing the filenames with the abbreviation of your campaign.

An example of how things seem to currently be done in many cases (picking on SoF again):

Code: Select all

[binary_path]
path=data/campaigns/Sceptre_of_Fire/
[/binary_path]

#ifdef CAMPAIGN_SCEPTRE_FIRE
[+units]
	{@campaigns/Sceptre_of_Fire/units/}
[/units]

{@campaigns/Sceptre_of_Fire/scenarios/utils/}
{@campaigns/Sceptre_of_Fire/scenarios}
#endif
An example of how it should be done:

Code: Select all

[binary_path]
path=data/campaigns/Sceptre_of_Fire/external_binary_data/
[/binary_path]

#ifdef CAMPAIGN_SCEPTRE_FIRE
[binary_path]
path=data/campaigns/Sceptre_of_Fire/
[/binary_path]

[+units]
	{@campaigns/Sceptre_of_Fire/units/}
[/units]

{@campaigns/Sceptre_of_Fire/scenarios/utils/}
{@campaigns/Sceptre_of_Fire/scenarios}
#endif
And in data/campaigns/Sceptre_of_Fire/external_binary_data/ we would then have the necessary files named like SoF_difficulty_easy.png, SoF_difficulty_normal.png, SoF_campaign_image.png, and so on.

Please, people, make this happen the next time you update your campaign.
Last edited by zookeeper on October 7th, 2006, 9:13 am, edited 1 time in total.

tsr
Posts: 790
Joined: May 24th, 2006, 1:05 pm

Post by tsr » July 5th, 2006, 8:25 am

Great post!

All clarifications of good use practice are great for new as well as experienced WML:ers.

I tried to update this page CampaignWML - binary path but couldn't come up with a good solution, anyone?

/tsr

User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga » July 5th, 2006, 10:45 am

Btw, for multiplayer eras, putting the [binary_path] inside the #ifdef MULTIPLAYER doesn't work well ...

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin » July 5th, 2006, 3:23 pm

I will do this as soon as the official campaigns do this.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper » July 5th, 2006, 3:58 pm

turin wrote:I will do this as soon as the official campaigns do this.
I've thought about making them do the same, but that would just lead to loss of the ability to conveniently use their images as campaign icons and such. I'm not sure if it would be a big loss, perhaps not.

Anyway, mainline campaigns aren't UMC's, and are looked after in a somewhat different manner, so I don't see why they would need to pretend to be UMC's. I know that at some point there was a decision to make them behave like UMC's as much as possible, but I don't see why it should extend to cover everything.

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin » July 5th, 2006, 4:24 pm

Because the official campaigns should be the model of how you properly make a campaign. If the official campaigns do not use this, it is not clear why UMCs should; but if official campaigns do use this, unofficial campaigns should do it to stay in line with mainline.

Anyway, it isn't a big deal.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan » July 5th, 2006, 4:51 pm

There's a very simple reason why UMC should do it an official not: you know what to expect from official campaigns to be available but you can't guard against naming conflicts with a UMC. Every installation should have all(*) official campaigns but you don't know which UMCs are installed.

(*)Yes, I disagree with the splitting done in debian. I'd prefer to see a wesnoth-core package just for MP and a wesnoth-campaigns with ALL official campaigns. The other case can lead to hardly predictable cases where a UMC tries to include something from an official one which should be allowed IMHO.
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!

User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam » July 5th, 2006, 8:45 pm

I think it could be better to modify how [binary_path] works.

Currently the tag...

[binary_path]
path=data/campaigns/My_Campaign
[/binary_path]


...says that image "data/campaigns/My_Campaign/images/example.png" can be written as "example.png". But so can be written the same image from another campaign. If instead I would have to write it as "My_Campaign/example.png", there would be no namespace conflicts. The extended tag could be e.g. like this:

[binary_path]
path=data/campaigns/My_Campaign
mount=My_Campaign
[/binary_path]


Well, it would a bit more difficult, but this is the idea...

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin » July 5th, 2006, 9:12 pm

torangan wrote:There's a very simple reason why UMC should do it an official not: you know what to expect from official campaigns to be available but you can't guard against naming conflicts with a UMC. Every installation should have all(*) official campaigns but you don't know which UMCs are installed.
Huh? Your reasoning makes no sense to me.

The reason official campaigns are structured like UMCs is so that we can add or remove campaigns easily - if we want to make a campaign official, all we have to do is put its stuff in data/campaigns/, and if we want to remove one, the same. It also helps to have the structure identical so that people creating new campaigns can just take an official campaign and modify the data. Having any difference between official campaigns and UMCs undermines both of these purposes.
torangan wrote:(*)Yes, I disagree with the splitting done in debian. I'd prefer to see a wesnoth-core package just for MP and a wesnoth-campaigns with ALL official campaigns. The other case can lead to hardly predictable cases where a UMC tries to include something from an official one which should be allowed IMHO.
I disagree that UMCs should be allowed to include stuff from official campaigns. If they want the data or images, they should duplicate them. Although this is redundant, it is IMHO better, because it means UMCs are self-sufficient - a change in another campaign cannot break your campaign.

In other words - if UMCs rely on official campaigns, and an image in the official campaign is deleted (because it is no longer used in the campaign), the UMC will be broken (this happened recently with the Gate unit in EI, which was removed, being used in a UMC). But if the UMC duplicates the data, there is no problem.

---

Villiam's idea seems OK, but I wouldn't really like having to put Sceptre_of_Fire/ in front of every image referenced in my campaign. I think zookeeper's solution is good; I just think it should be applied to mainline campaigns as well.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper » July 5th, 2006, 9:52 pm

All right, I promise to apply this to mainline campaigns as well. Not immediately, but in the near future (before 1.2).

Now...get to work you lot. :P

User avatar
BlackOpsElf
Posts: 95
Joined: June 22nd, 2006, 8:25 pm

Post by BlackOpsElf » July 13th, 2006, 6:56 pm

I have updated my campaign, Where Angels Fear to Tread, in order to bring it in line with this policy.

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper » July 22nd, 2006, 12:27 am

I have now updated all mainline campaigns to comply with this.

User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M » August 6th, 2006, 1:37 pm

I'm having a few problems doing this, for some reason when I put binary path tags both inside the #ifdef (for the files in the campaign) and outside (for the campaign icon, image and difficulty icons) the campaign icon, difficulty icons and the image in the campaign description have stopped appearing, even though all of the paths are correct (I've checked about 5 times), so I can't figure out why it's not working. I've attached the .cfg file so that you can check (although you'll just have to take my word on the paths being correct, as I can't post the whole campaign on the forums).

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper » August 6th, 2006, 2:22 pm

Ranger M wrote:I'm having a few problems doing this, for some reason when I put binary path tags both inside the #ifdef (for the files in the campaign) and outside (for the campaign icon, image and difficulty icons) the campaign icon, difficulty icons and the image in the campaign description have stopped appearing, even though all of the paths are correct (I've checked about 5 times), so I can't figure out why it's not working. I've attached the .cfg file so that you can check (although you'll just have to take my word on the paths being correct, as I can't post the whole campaign on the forums).
Looks like it's because you included the images/ subdirectory in the path names. All image= (or similar) keys automatically look in the images/ subdirectories of all binary paths that have been given, so when you write image=images/IoA-Reth.png the game actually (among others) looks for the image external_binary_data/images/images/IoA-Reth.png.

User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M » August 6th, 2006, 2:40 pm

zookeeper wrote:Looks like it's because you included the images/ subdirectory in the path names. All image= (or similar) keys automatically look in the images/ subdirectories of all binary paths that have been given, so when you write image=images/IoA-Reth.png the game actually (among others) looks for the image external_binary_data/images/images/IoA-Reth.png.
I'll try changing it, but I doubt that it will work, I only moved them from being immediately inside the external-binary-data directory to being inside images within external binary data when I realised that that was what the mainline campaigns had done while I was trying to work out what was wrong (yeah, it sounds like an odd thing to do, but I'd tried everything else).

EDIT: acutally I may have misread your post, I'll try removing the images/ from the Invasion_of_Arendia.cfg file.

EDIT 2: yep, that worked. But I don't get why it works like that, it seems a little pointless and confusing if you don't know about it. Does this happen anywhere else within a UMC?

Post Reply