Sloppy use of [binary_path]s
Moderator: Forum Moderators
Sloppy use of [binary_path]s
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):
An example of how it should be done:
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.
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
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
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.
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
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
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
And I hate stupid people.
The World of Orbivm
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.turin wrote:I will do this as soon as the official campaigns do this.
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.
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.
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
And I hate stupid people.
The World of Orbivm
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.
(*)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!
http://www.wesnoth.org/wiki/WesCamp
Translators for all languages required: contact me. No geek skills required!
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
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...
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...
Huh? Your reasoning makes no sense to me.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.
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.
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.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.
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
And I hate stupid people.
The World of Orbivm
- BlackOpsElf
- Posts: 95
- Joined: June 22nd, 2006, 8:25 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).
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.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).
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).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.
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?