Difference between revisions of "BuildingCampaigns"

From The Battle for Wesnoth Wiki
 
(update; add some additional links/wording)
 
(63 intermediate revisions by 25 users not shown)
Line 1: Line 1:
This page describes how to make your own user campaign for use with Battle for Wesnoth.  Please note that this document
+
{{Translations}}
is not normative - its author is
 
not a Wesnoth Developer.  I'm simply reporting on what works for me, and on what developers have prescribed elsewhere.
 
If you see any errors, please fix
 
them.
 
  
See also forum post
+
{{Create}}
<a href="http://www.wesnoth.org/forum/viewtopic.php?p=84176#84176">Eight things to check when your scenario doesn't
 
load</a>.
 
  
There are several steps to building a single player campaign in Wesnoth.  The mechanics are covered in the sections below:
+
{| style="float:right; margin-left:1em;"
 +
|__TOC__
 +
|}
  
* [[BuildingCampaignsDirectoryStructure]]
+
While a single scenario might be used to create a single battle to play with your friends, a campaign is a number of scenarios grouped together to tell a story. Scenarios in a campaign usually depict specific locations that tell a bit of the story, as opposed to the "arenas" of multiplayer.
* [[BuildingCampaignsTheCampaignFile]]
 
* [[BuildingCampaignsThePBLFile]]
 
* [[BuildingCampaignsCreatingScenariosAndMaps]]
 
* [[BuildingCampaignsAddingUnitsArtworkMusicAndSounds]]
 
* [[BuildingCampaignsBalancing]]
 
* [[BuildingCampaignsDistribution]]
 
  
What follows is a collection of advice to aspiring campaign designers extracted from the Wesnoth fora.
+
Assuming you have your add-on set up with a basic _main.cfg as described in [[AddonStructure]], this page will guide you through the use of the [campaign] tag, as well as some general advice for designing the story.
  
== Start with Something Manageable ==
+
<b>Note:</b> <b>A Simple Campaign</b> by Anonymissimus or '''The Final Exam''' by Elven are add-ons made to help people starting to create their first campaign. You ought to be able download them from the add-ons server for your Wesnoth version (if they haven't been ported to your version yet, try a different version).
  
If you set out to make an epic campaign spanning the whole history of Wesnoth, you'll likely (not necessarily, though)
+
<!-- (NOTE: this text may or may not be needed anymore. I intend these pages on the wiki to be a guide  itself, plus this link is very incomplete... leaving it here in a comment to decide on later - Vultraz, 3/17/14) Because many aspiring campaign developers find the initial creation of a working campaign to be difficult (if not exasperating) a [[BuildingCampaignsTutorial|step-by-step tutorial]] covering the initial phase of campaign development (getting it to work) is under construction.  It includes a working campaign that you can install, and then alter to fit your own needs. -->
become bored or frustrated along the
 
way somewhere and give up.  It's much easier to start with a small story and add elements to it than it is to cut an
 
epic down to the lenght of a haiku.
 
  
Shade (author of The Rise of Wesnoth) wrote:
+
== Setting up the campaign ==
  
    I started TRoW last April, even after it was scenario complete it was still eating all of my free time
+
<div class="thumb tright"><div>
    (Time not spent sleeping, at school / work, or with loved ones / friends) until mid-November...
+
[http://www.wesnoth.org/wiki-images/wesnoth-campaigns-menu-1.11.11.jpg http://www.wesnoth.org/wiki-images/wesnoth-campaigns-menu-1.11.11-175.jpg]
    Even now there is still bugfixing and a couple of things I'd like to add... and keeping it up to date with the
+
<div class="thumbcaption"><i>The South Guard</i></div></div>
    game engine and any new happenings on the WML front... so there is still quite a lot to keep you busy after you are
+
</div>
    done...
 
    The forums are littered with half finished epics...
 
    Before you commit to an epic think long and hard. I don't want to discourage you too much...
 
    But it is a lot of 'work' (& fun)
 
  
== Story First ==
+
Technically, a campaign is simply a string of scenarios with <b>next_scenario=<i>id</i></b> keys in toplevel (see [[BuildingScenarios]]), where the value of <b><i>id</i></b> is in the key of the same name in toplevel. This allows each one to load the next. But how to begin playing? By setting up a [campaign] tag in your _main.cfg.
  
What separates a campaign from a single scenario is the ability to tell a story. Consequently, what keeps people coming
+
The [campaign] tag is like the campaign's "cover". It will display your work in the campaign selection dialog with a description, an image (as shown on the right), as well as allowing the user to select a difficulty level before beginning to play.
back for more is a good,
 
interesting story mixed with good, interesting game play.  If you have a good idea of where the story of your campaign
 
is going when you start, the little
 
piece will fall into place much more easily. After all, it's worked for Pixar!
 
  
Scott (author of Liberty, the outlaw campaign) wrote:
+
* It should be placed in your _main.cfg <b>outside</b> any preprocessor conditionals
 +
* For the <b>#ifdef</b> conditional, you should use the format <b>#ifdef <i>YOUR_DEFINE_HERE</i></b> (you may define one in [campaign]).
  
    Here is how I wrote Liberty.
+
The full syntax of the [campaign] tag is documented in [[CampaignWML]], and an example of a fully featured _main.cfg with one in use can be found on the [[BuildingCampaignsTheCampaignFile]] page. If you run into errors while putting things together, [[DebuggingCampaigns]] has a few tips.
  
    1. Write a rough story and plot
+
<b>Note:</b> By default, you will find your campaign in the singleplayer selection menu. If you intend to create a multiplayer campaign, see [[MultiplayerContent]] for the required syntax amendments.
    2. Decide how many scenarios you want to have
 
    3. Divide the story between the scenarios so you can decide what will happen in each scenario
 
        - where are you?
 
        - who are you fighting and why?
 
        - what do you have to do in this scenario?
 
        - where does the hero want to go next?
 
    4. Decide on the "hook" for each scenario. There are a lot of different possible setups for scenarios, and
 
    if you want to avoid the boring repetition of "Kill the 2 enemy leaders" you can listing out interesting
 
      combinations of enemies, allies, shroud/fog, day/night effects, recruiting and terrain situations, etc.
 
    and pick a good mix to keep the combat interesting and fun.
 
  
    All of this has happened without doing any WML, but now you have enough to start coding.
+
== Designing the campaign ==
 +
What follows is a collection of advice to aspiring campaign designers extracted from the Wesnoth forums.  For a more in-depth treatment including heuristics for scenario and campaign balancing, see the [http://catb.org/~esr/wesnoth/campaign-design-howto.html Campaign Design How-To].
  
== Share Early ==
+
=== Start with Something Manageable ===
  
Don't be shy to post whatever you've created for others to look atWe all had to learn too, and there are many people
+
If you set out to make an epic campaign spanning the whole history of Wesnoth, you'll likely (although not necessarily) become bored or frustrated along the way somewhere and give upIt's much easier to start with a small story and add elements to it than it is to cut an epic down to the length of a haiku.
on the Scenario and Campaign
 
Development forum (http://www.wesnoth.org/forum/viewforum.php?f=8) who are eager to help people learn.
 
  
Turin (author of Eastern Invasion) wrote:
+
;Shade (author of The Rise of Wesnoth) wrote<nowiki>:</nowiki>
 +
: <i>"I started TRoW last April, even after it was scenario complete it was still eating all of my free time (Time not spent sleeping, at school / work, or with loved ones / friends) until mid-November... Even now there is still bugfixing and a couple of things I'd like to add... and keeping it up to date with the game engine and any new happenings on the WML front... so there is still quite a lot to keep you busy after you are done... The forums are littered with half finished epics... Before you commit to an epic think long and hard. I don't want to discourage you too much... But it is a lot of 'work' (& fun)."</i>
  
    I'm working on a loyalist campaign now. I already have the basic plot. I am wondering if anyone wants
+
=== Story First ===
    to playtest my completed levels (i am done with two).  Thus i want to know if i should just post the new files
 
    as attachments, or what. There are two map files, two scenario files, an image file, a unit file, and you have
 
    to change the game file to access the campaign from the 'campaign menu. So tell me how i should make them accessable.
 
  
== Steal Often ==
+
What separates a campaign from a single scenario is the ability to tell a story. Consequently, what keeps people coming back for more is a good, interesting story mixed with good, interesting game play.  If you have a good idea of where the story of your campaign is going when you start, the little
 +
pieces will fall into place much more easily.  After all, it worked for Pixar!
  
There are too many quotations to pick one for this maxim.  The best way to learn how to do something is to copy it from
+
;Scott (author of Liberty) wrote:
someone else's campaign. It's
+
: "Here is how I wrote Liberty:
polite to ask first, and most Campaign designers are happy to see small bits of their WML living in other campaigns.
+
:# Write a rough story and plot
It's generally poor form to copy whole
+
:# Decide how many scenarios you want to have
scenarios, maps, and campaigns, though. And especially poor form to do so without permission.
+
:# Divide the story between the scenarios so you can decide what will happen in each scenario:
 +
:#* Where are you?
 +
:#* Who are you fighting and why?
 +
:#* What do you have to do in this scenario?
 +
:#* Where does the hero want to go next?
 +
:# Decide on the "hook" for each scenario. There are a lot of different possible setups for scenarios, and if you want to avoid the boring repetition of "Kill the 2 enemy leaders" you can list interesting combinations of enemies, allies, shroud/fog, day/night effects, recruiting and terrain situations, etc. and pick a good mix to keep the combat interesting and fun.   
 +
: All of this has happened without doing any WML, but now you have enough to start coding."
  
== Next: ==
+
The [http://catb.org/~esr/wesnoth/campaign-design-howto.html Campaign Design How-To] has much more to say about this storyboarding phase of the process.
* [[BuildingCampaignsTheCampaignFile]]
 
  
 +
=== Share Early ===
  
== The Old Page (Deprecated) ==
+
Don't be shy to post whatever you've created for others to look at.  We all had to learn too, and there are many people on the [http://www.wesnoth.org/forum/viewforum.php?f=8 Scenario and Campaign Development forum] who are eager to help people learn.
  
There are two parts, usually, to a scenario: the scenario itself, which is written in WML, and a map, which is a plain
+
;Turin (author of Eastern Invasion) wrote<nowiki>:</nowiki>   
text file, usually created with wesnoth_editor. The map can also be included in the scenario, though that makes it hard
+
: <i>"I'm working on a loyalist campaign now. I already have the basic plot. I am wondering if anyone wants to playtest my completed levels (I am done with two)Thus I want to know if I should just post the new files as attachments, or what. There are two map files, two scenario files, an image file, a unit file, and you have to change the game file to access the campaign from the 'campaign menu. So tell me how I should make them accessible."</i>
to editProbably the best way to start is by designing the map, then create a simple scenario file, then alternative
 
between playing and modifing your scenario file until you are satisfied with it.
 
  
There is a very good tutorial on this under the [[BuildingScenarios]] topic.  Unfortunately, it is a little out of date.
+
=== Steal Often ===
Once you have read that, look at the sources to the [[MainlineScenarios]], which are installed with wesnoth itself (but
 
beware, these campaigns are not set up in the same way a user campaign should be - see below).  Prescriptive
 
documentation of WML can be found at [[ReferenceWML]].
 
  
Of course, before you can play a scenario, you need to install it...
+
There are too many quotations to pick one for this maxim. The best way to learn how to do something is to copy it from someone else's campaign.  It's polite to ask first, and most campaign designers are happy to see small bits of their WML living in other campaigns.
 
+
It's generally poor form to copy whole scenarios, maps, and campaigns, though. And especially poor form to do so without permission and/or attribution. To be uploaded to the Wesnoth add-on server, add-ons have to have a compatible license (usually GPL or CC-BY-SA), so be sure to abide by the terms of whichever license is used when copying.
Your campaign file should contain three things:
 
 
 
1) a WML [campaign] tag,
 
 
 
2) WML preprocessor instructions to load your scenarios, units, etc. and
 
 
 
3) (if your campaign adds images or sounds) a [binary_path] tag to help load those files.
 
 
 
For reference documentation on this, see [[CampaignWML]].
 
 
 
Here's the example from the forum post, slightly tidied up:
 
 
 
[campaign]
 
id=sample_campaign
 
icon=some_icon.png
 
  name= _ "Sample Campaign"
 
define=CAMPAIGN_SAMPLE_CAMPAIGN
 
first_scenario=some_scenario_id
 
difficulties=EASY,NORMAL,HARD
 
difficulty_descriptions= _ "&easy_icon.png,Easy;*&normal_icon.png,Normal;&hard_icon.png,Hard"
 
[/campaign]
 
 
 
#ifdef CAMPAIGN_SAMPLE_CAMPAIGN
 
 
 
[+units]
 
{campaigns/Sample_Campaign/units}
 
{~campaigns/Sample_Campaign/units}
 
[/units]
 
 
 
{campaigns/Sample_Campaign/scenarios}
 
{~campaigns/Sample_Campaign/scenarios}
 
 
 
[binary_path]
 
path=data/campaigns/Sample_Campaign/
 
[/binary_path]
 
#endif
 
 
 
There are two important features of this that aren't self-explanatory.
 
First, the use of the #ifdef.
 
Wesnoth loads its configuration once at startup, and then again when you start playing.
 
The first time, CAMPAIGN_SAMPLE_CAMPAIGN will not be defined, and your scenarios will not be loaded,
 
nor will the [binary_path] tag be used.
 
The second time, when the user starts your campaign,
 
CAMPAIGN_SAMPLE_CAMPAIGN will be defined, and the scenarios will be loaded.
 
This prevents your campaign from treading on others' toes
 
(for example, if two user campaign are installed this way,
 
they can both give the same name to a scenario without clashing).
 
It also means that you can customise global wesnoth settings
 
(the terrain configuration, for example) on a per-campaign basis.
 
 
 
However, notice that [+units] is not inside the #ifdef.
 
This is due to a bug in Wesnoth programming that causes
 
savegames in your campaign to be corrupt if you try to put it in.
 
Unfortunately, this means that you need to make sure that
 
none of your units conflict with other user or mainline units. ''This
 
sounds completely wrong, [units] tags should be inside the campaign
 
#ifdef at least since 0.9.0, can someone please confirm if this
 
is still an issue?//
 
 
 
Second, the [binary_path] tag allows images and sounds to be installed inside the
 
{campaigns/Sample_Campaign} directory instead of the default Wesnoth path.
 
(Note: If you want to use one of these images as your campaign icon,
 
you need to move [binary_path] out of the #ifdef.)
 
 
 
Now, you install all the rest of your campaign under the directory {campaigns/Sample_Campaign}.
 
Maps go in {campaigns/Sample_Campaign/maps}, scenarios go in {campaigns/Sample_Campaign/scenarios},
 
images go in {campaigns/Sample_Campaign/images}, and so on.
 
This makes it easy for a user to delete your campaign from their system,
 
and is required in order to upload it to the campaign server (see bottom).
 
 
 
You can refer to your images, installed this way, as "some-image.png"
 
(that's the work of [binary_path]), and include maps by using the preprocessor syntax
 
"{@campaigns/Sample_Campaign/maps/mymap}" with the map_data attribute.  You
 
might also define a preprocessor macro to abstract away from the title of your campaign.  For example, you might write
 
the end of the campaign file like this:
 
 
 
...
 
#ifdef CAMPAIGN_SAMPLE_CAMPAIGN
 
 
 
#define MAP NAME
 
  map_data="{@campaigns/Sample_Campaign/maps/{NAME}}"
 
#enddef
 
 
 
{@campaigns/Sample_Campaign/scenarios}
 
 
 
[binary_path]
 
path=data/campaigns/Sample_Campaign/
 
[/binary_path]
 
#endif
 
 
 
Now your scenarios can refer to their maps by saying "{MAP mymap}",
 
without having to know the name of the campaign they're included in,
 
which might be helpful - if you ever change the name of your campaign,
 
you don't want to have to edit all the scenarios.
 
  
 
== See Also ==
 
== See Also ==
  
 +
* [[Create]]
 
* [[BuildingScenarios]]
 
* [[BuildingScenarios]]
 
* [[ReferenceWML]]
 
* [[ReferenceWML]]
* [[UserScenarios]]
+
* [[Guide_to_UMC_Content]]
* [[ExternalUtilities]]
+
* [[MakingCampaignInWML]]
 
+
* [http://www.catb.org/~esr/wesnoth/campaign-design-howto.html Campaign Design How To]

Latest revision as of 20:43, 24 November 2021



While a single scenario might be used to create a single battle to play with your friends, a campaign is a number of scenarios grouped together to tell a story. Scenarios in a campaign usually depict specific locations that tell a bit of the story, as opposed to the "arenas" of multiplayer.

Assuming you have your add-on set up with a basic _main.cfg as described in AddonStructure, this page will guide you through the use of the [campaign] tag, as well as some general advice for designing the story.

Note: A Simple Campaign by Anonymissimus or The Final Exam by Elven are add-ons made to help people starting to create their first campaign. You ought to be able download them from the add-ons server for your Wesnoth version (if they haven't been ported to your version yet, try a different version).


Setting up the campaign

wesnoth-campaigns-menu-1.11.11-175.jpg

The South Guard

Technically, a campaign is simply a string of scenarios with next_scenario=id keys in toplevel (see BuildingScenarios), where the value of id is in the key of the same name in toplevel. This allows each one to load the next. But how to begin playing? By setting up a [campaign] tag in your _main.cfg.

The [campaign] tag is like the campaign's "cover". It will display your work in the campaign selection dialog with a description, an image (as shown on the right), as well as allowing the user to select a difficulty level before beginning to play.

  • It should be placed in your _main.cfg outside any preprocessor conditionals
  • For the #ifdef conditional, you should use the format #ifdef YOUR_DEFINE_HERE (you may define one in [campaign]).

The full syntax of the [campaign] tag is documented in CampaignWML, and an example of a fully featured _main.cfg with one in use can be found on the BuildingCampaignsTheCampaignFile page. If you run into errors while putting things together, DebuggingCampaigns has a few tips.

Note: By default, you will find your campaign in the singleplayer selection menu. If you intend to create a multiplayer campaign, see MultiplayerContent for the required syntax amendments.

Designing the campaign

What follows is a collection of advice to aspiring campaign designers extracted from the Wesnoth forums. For a more in-depth treatment including heuristics for scenario and campaign balancing, see the Campaign Design How-To.

Start with Something Manageable

If you set out to make an epic campaign spanning the whole history of Wesnoth, you'll likely (although not necessarily) become bored or frustrated along the way somewhere and give up. It's much easier to start with a small story and add elements to it than it is to cut an epic down to the length of a haiku.

Shade (author of The Rise of Wesnoth) wrote:
"I started TRoW last April, even after it was scenario complete it was still eating all of my free time (Time not spent sleeping, at school / work, or with loved ones / friends) until mid-November... Even now there is still bugfixing and a couple of things I'd like to add... and keeping it up to date with the game engine and any new happenings on the WML front... so there is still quite a lot to keep you busy after you are done... The forums are littered with half finished epics... Before you commit to an epic think long and hard. I don't want to discourage you too much... But it is a lot of 'work' (& fun)."

Story First

What separates a campaign from a single scenario is the ability to tell a story. Consequently, what keeps people coming back for more is a good, interesting story mixed with good, interesting game play. If you have a good idea of where the story of your campaign is going when you start, the little pieces will fall into place much more easily. After all, it worked for Pixar!

Scott (author of Liberty) wrote
"Here is how I wrote Liberty:
  1. Write a rough story and plot
  2. Decide how many scenarios you want to have
  3. Divide the story between the scenarios so you can decide what will happen in each scenario:
    • Where are you?
    • Who are you fighting and why?
    • What do you have to do in this scenario?
    • Where does the hero want to go next?
  4. Decide on the "hook" for each scenario. There are a lot of different possible setups for scenarios, and if you want to avoid the boring repetition of "Kill the 2 enemy leaders" you can list interesting combinations of enemies, allies, shroud/fog, day/night effects, recruiting and terrain situations, etc. and pick a good mix to keep the combat interesting and fun.
All of this has happened without doing any WML, but now you have enough to start coding."

The Campaign Design How-To has much more to say about this storyboarding phase of the process.

Share Early

Don't be shy to post whatever you've created for others to look at. We all had to learn too, and there are many people on the Scenario and Campaign Development forum who are eager to help people learn.

Turin (author of Eastern Invasion) wrote:
"I'm working on a loyalist campaign now. I already have the basic plot. I am wondering if anyone wants to playtest my completed levels (I am done with two). Thus I want to know if I should just post the new files as attachments, or what. There are two map files, two scenario files, an image file, a unit file, and you have to change the game file to access the campaign from the 'campaign menu. So tell me how I should make them accessible."

Steal Often

There are too many quotations to pick one for this maxim. The best way to learn how to do something is to copy it from someone else's campaign. It's polite to ask first, and most campaign designers are happy to see small bits of their WML living in other campaigns. It's generally poor form to copy whole scenarios, maps, and campaigns, though. And especially poor form to do so without permission and/or attribution. To be uploaded to the Wesnoth add-on server, add-ons have to have a compatible license (usually GPL or CC-BY-SA), so be sure to abide by the terms of whichever license is used when copying.

See Also

This page was last edited on 24 November 2021, at 20:43.