How to create a campaign
Lots of ideas for new campaigns or improvement of the existing ones have come to your mind, but you don't know how to bring them into the game? This wiki page tries to bring all the stuff together that is related to the creation (or modification) of campaigns. We start from what a widelands campaign is and what it consists of. At the end, you should be able to create new campaigns and you will know the way to bring them into the game. However, this wiki page does no in-depth-teaching. It rather serves as an overview but always links to specialized pages for those, who want to dig deeper into the material.
What a campaign is
You find the preinstalled campaigns from the widelands main menu via Single Player, Campaigns. On a fresh installed widelands, you're just allowed to play the Barbarian campaign. After completing it, you can continue to the next one. In widelands, a campaign is a set of one or more missions that usually tell a story and that are played sequentially. The player is led to fulfill special and sometimes difficult objectives which often are completely different from the typical goals of an endless game.
What a campaign consists of
Although the creation of a campaign is a bit more challenging than the creation of some maps, it is still no mystic stuff - it just needs a nice story and some additional scripting. The things that are needed to create a campaign are therefore:
- A story that your campaign is about - can be historical or phantasy.
- One or more missions (also called "scenarios") - each of which is part of the story. When they are played one after another, the player dives into your story.
What a mission consists of
As a campaign is composed of missions, you will have to know what the difference between a mission and a normal map is. So these are the things a mission consists of:
- A map - can be created via the integrated editor.
- Scripts (Lua) - They tell the story through message boxes. They define objectives and tests for their completing. They unveil the next mission in this campaign. They modify the map, etc.
- Data that is needed by the scripts, such as additional pictures to show the leader of your tribe when he/she is "speaking" to you.
Once you have an overview and some details what your story is about, you will have to create the maps that your missions will be based on. This is done via the integrated editor (select the button "Editor" from the widelands main menu). There is a nice Editor tutorial in this wiki.
The Lua scripts reside in the
scripting subdirectory of your map. You might have to create this directory first. The most important scripting file (and the only one that you really need) is
init.lua - which does the whole initialization stuff, such as:
- defining objectives and launching routines to check them,
- selecting a text domain for translation into other languages than English,
- filling the headquarters with initial wares,
- allowing/disallowing some buildings,
- defining map regions that have a special meaning for the story
- telling the relevant part story while playing the mission
Bring your campaign into the game
After creating your missions, you can test them by calling widelands with the
--scenario=<filename> option where you replace
<filename> with your map directory, e.g.
If you want to combine your missions into a campaign that you can access via the Single Player, Campaigns buttons, you should have a look at the
campaigns/campaigns.conf file which is also explained in this wiki. You will have to copy your missions to the
campaigns folder as well.
Currently, the campaign tutorial just consists of the
But maybe, there is a step-by-step tutorial to come