1.18 "Add-on ID" structure questions
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.
1.18 "Add-on ID" structure questions
I've made a couple campaigns (initially for 1.12, now ported to 1.16) and am considering switching to 1.18. But I'm not sure I understand the new add-on structure and its "ID".
Given all my campaigns happen in a specific non-Wesnoth universe with dozens of custom units, I definitely see the advantage of putting everything in one single of those add-on folders, and having all campaigns find their units, images and macros in a single place. It would not only cut down on size, but also make my life easier (only one file to update each time I make a change).
But can you put several separated campaigns in a single of those "add-on ID" folders? Is this even possible?
Or did I misunderstand the system and it's just an overhauled, more automated version of the old one, i.e. each campaign needs still to be in its own add-on folder tree?
In this case, remains the question which is the best way to handle a slew of common files without duplicating them into each campaign folder?
Given all my campaigns happen in a specific non-Wesnoth universe with dozens of custom units, I definitely see the advantage of putting everything in one single of those add-on folders, and having all campaigns find their units, images and macros in a single place. It would not only cut down on size, but also make my life easier (only one file to update each time I make a change).
But can you put several separated campaigns in a single of those "add-on ID" folders? Is this even possible?
Or did I misunderstand the system and it's just an overhauled, more automated version of the old one, i.e. each campaign needs still to be in its own add-on folder tree?
In this case, remains the question which is the best way to handle a slew of common files without duplicating them into each campaign folder?
Re: 1.18 "Add-on ID" structure questions
Feels like misunderstanding, would you show which announcement or documentation you mean. You can still use multiple addons. But if you want you can also have multiple user-visible campaigns in one addon.
Addons can have dependencies, you declare them in _server.pbl. You can have dependency addon containing common part.
Addons can have dependencies, you declare them in _server.pbl. You can have dependency addon containing common part.
Re: 1.18 "Add-on ID" structure questions
That's what I'm looking for indeed. How does that work? Is there any example I can study?Ravana wrote: July 8th, 2026, 3:13 pm But if you want you can also have multiple user-visible campaigns in one addon.
I thought "_server.pbl" was just for the server upload/download management (as the name hints at), and not used by the game itself (once the files on your computer).Ravana wrote: July 8th, 2026, 3:13 pm Addons can have dependencies, you declare them in _server.pbl. You can have dependency addon containing common part.
Can you please be more specific, ideally point me to an example?
Re: 1.18 "Add-on ID" structure questions
Ageless contains [modification] https://github.com/ProditorMagnus/Agele ... ce.cfg#L37 and [era] https://github.com/ProditorMagnus/Agele ... era.cfg#L4. Both are toplevel addon tags, so can be published in separate addons.
I also use images from multiple addons https://github.com/ProditorMagnus/Agele ... in.cfg#L62
_server.pbl with dependencies=Era_of_Magic_Resources,Ageless_Resources tells addon server which addons to ask user download in addition. Actual logic what you do with those addons during runtime is up to your code. Using it as binary path or reading files from it or something else.
I also use images from multiple addons https://github.com/ProditorMagnus/Agele ... in.cfg#L62
_server.pbl with dependencies=Era_of_Magic_Resources,Ageless_Resources tells addon server which addons to ask user download in addition. Actual logic what you do with those addons during runtime is up to your code. Using it as binary path or reading files from it or something else.
Re: 1.18 "Add-on ID" structure questions
Thanks! Though it's a little over my pay grade.Ravana wrote: July 8th, 2026, 3:49 pm Ageless contains [modification] https://github.com/ProditorMagnus/Agele ... ce.cfg#L37 and [era] https://github.com/ProditorMagnus/Agele ... era.cfg#L4. Both are toplevel addon tags, so can be published in separate addons.
I'm no developer, I can manage with WML since it's pretty much plain English, and there are lots of examples to see what the exact syntax is, but LUA and such are totally out of my reach...
I can make (nice?) stories, but my coding skills are basic.
That's what I've instinctively done too, I initially put everything common (images, macros, units, etc.) in a common folder, but it doesn't seem elegant (to me), because if I want to eventually upload one campaign I'll need to upload the campaign tree and the resource tree. And, if after that I upload another campaign, despite the resource tree being only needed once, it has to be downloaded twice just the same (because Murphy's law says that else it will be missing altogether...Ravana wrote: July 8th, 2026, 3:49 pm I also use images from multiple addons https://github.com/ProditorMagnus/Agele ... in.cfg#L62
So when porting to 1.16 I went back to the old self-contained campaign folders system. It's suboptimal but at least it works.
What would be nice is to be able to put several campaigns in the same /scenario folder, and have different _main.cfg files for each (guess they would need to have personalized names, like "_main_MyFirstCampaign.cfg", "_main_MySecondCampaign.cfg"). Oh well.
I'm not yet thinking about up/downloading. I'm still battling with final details (some scripts missing, couple images missing) for the main campaign (10 scenarios), the others are smaller ones, just for fun.Ravana wrote: July 8th, 2026, 3:49 pm _server.pbl with dependencies=Era_of_Magic_Resources,Ageless_Resources tells addon server which addons to ask user download in addition. Actual logic what you do with those addons during runtime is up to your code.
And yes, what I do with those add-ons during runtime is indeed my concern right now...
Thanks for your time!
- Pentarctagon
- Project Manager
- Posts: 5824
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: 1.18 "Add-on ID" structure questions
You can do that, you'd just need to reference each of the campaign-specific _main.cfg files from the root one.kurt751 wrote: July 8th, 2026, 5:22 pm What would be nice is to be able to put several campaigns in the same /scenario folder, and have different _main.cfg files for each (guess they would need to have personalized names, like "_main_MyFirstCampaign.cfg", "_main_MySecondCampaign.cfg"). Oh well.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: 1.18 "Add-on ID" structure questions
Maybe look at Legend of the Invincibles on the add-on server - it's one single add-on but it contains two campaigns. Is that what you want?
Re: 1.18 "Add-on ID" structure questions
Interesting. Any example where I can check how actually this works? I'm meaning, the exact syntax?Pentarctagon wrote: July 8th, 2026, 5:28 pm You can do that, you'd just need to reference each of the campaign-specific _main.cfg files from the root one.
Re: 1.18 "Add-on ID" structure questions
Will do, thanks!gnombat wrote: July 8th, 2026, 5:54 pm Maybe look at Legend of the Invincibles on the add-on server - it's one single add-on but it contains two campaigns. Is that what you want?
- Pentarctagon
- Project Manager
- Posts: 5824
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: 1.18 "Add-on ID" structure questions
In the root _main.cfg, use file inclusion (https://wiki.wesnoth.org/PreprocessorRe ... ive_.7B.7D) for each campaign-specific _main.cfg in other sub-folders.kurt751 wrote: July 9th, 2026, 5:51 amInteresting. Any example where I can check how actually this works? I'm meaning, the exact syntax?Pentarctagon wrote: July 8th, 2026, 5:28 pm You can do that, you'd just need to reference each of the campaign-specific _main.cfg files from the root one.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: 1.18 "Add-on ID" structure questions
Thanks, this page helps me a lot. I've been looking for that information but couldn't find it (Because extra_defines were deprecated and the WML reference just says "define macros instead", but as incredible it might seem for developers, I needed to check how (and where) exactly you declare campaign-specific macros...
).
- Pentarctagon
- Project Manager
- Posts: 5824
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: 1.18 "Add-on ID" structure questions
Apparently it was somehow missing from https://wiki.wesnoth.org/CampaignWML, but you'd want to use the
define attribute of [campaign]. For example: https://github.com/wesnoth/wesnoth/blob ... in.cfg#L1699 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: 1.18 "Add-on ID" structure questions
Thanks, that part I have mastered, even those new
The part I'm still not sure about is how to best handle (declare) custom macros: Do I include them in the _main.cfg, or do I just put them in /utils/macros.cfg?
Lots of trial and (lots of) error. I usually just stick with the solution which works, even if I don't necessarily understand why it does so...
WML isn't so hard for a non-programmer, the hardest part usually being to find documentation about using some function, as opposed to just a pithy mention it exists.
[modify_unit_type] tags I now have to use (have dozens of them in each _main.cfg...).The part I'm still not sure about is how to best handle (declare) custom macros: Do I include them in the _main.cfg, or do I just put them in /utils/macros.cfg?
Lots of trial and (lots of) error. I usually just stick with the solution which works, even if I don't necessarily understand why it does so...
WML isn't so hard for a non-programmer, the hardest part usually being to find documentation about using some function, as opposed to just a pithy mention it exists.
Re: 1.18 "Add-on ID" structure questions
You need to include macros in _main.cfg, but for readability its common to put their definition in another file like utils. If you do not include them ({./utils/macros.cfg}) in _main.cfg then utils file will not be read. Wesnoth does not look files unless you tell it to look through _main.cfg.
Re: 1.18 "Add-on ID" structure questions
So I have the choice. Thanks, good to know!Ravana wrote: July 11th, 2026, 7:30 am for readability its common to put their definition in another file like utils.
Yes, I know that, I have already several macros in /utils/macros.cfg, mostly custom abilities/weapon definitions.Ravana wrote: July 11th, 2026, 7:30 amIf you do not include them ({./utils/macros.cfg}) in _main.cfg then utils file will not be read.
It's the deprecation (?) of
extra_defines which confused me, or rather its explanation in the CampaignWML page: It isn't clear about what exactly has changed, and since wmllint seemed to take offense on my old 1.12 extra_defines, I removed them and replaces them with a long list of [modify_unit_type] entries (which define how my custom units connect with the core ones)...