MultiplayerContent
Contents
Building multiplayer campaigns
Recent versions of wesnoth (which ones?) have support for campaigns that can be played in multiplayer mode, with your friends, or even with an AI. The support is pretty basic at this point, so there will be some things that don't work as expected. This page only documents the differences between writing multiplayer campaigns and single player campaigns, so you might want to read up on BuildingCampaigns and BuildingMultiplayer first.
The campaign file
Multiplayer campaigns do not use the [campaign] tag. As a result of this, multiplayer campaigns only support one difficulty level, though you could support more with enough WML, if you're feeling ambitious. The "campaign file" should look something like this:
#ifdef MULTIPLAYER {@campaigns/My_Campaign/scenarios} #endif
Anything that you would normally put in the campaign tag now goes into the first scenario, if it's supported there. The order of scenarios is determined by next_scenario tags, just like in single player.
Scenarios
A scenario in a multiplayer campaign is almost identical to a scenario in a single player campaign. You only need to change the following:
- The [scenario] tag should be replaced with a [multiplayer] tag.
- Every scenario after the first should have allow_new_game=no inside the [multiplayer] tag. This will prevent it from showing up in the map selection menu. This does not work in v1.1, but it causes no harm, and it will work in the future.
- In v1.1, Every scenario in the campaign will appear on the map selection menu, so be sure to include your campaign's name in the [multiplayer] tag's name key. Alternatively, include a warning like "DO NOT PLAY".
- Each human-controlled side needs to have a save_id defined inside their [side] tag. Each side's save_id should be unique, and it should be the same in every scenario. Without this, your recall lists and leaders will not carry over from one scenario to the next.
- Each AI-controlled side should have allow_player=no in their [side] tag.
The first scenario
The first scenario might need some extra work, because the settings from the multiplayer dialog will override the settings in the scenario. However, most of the multiplayer settings can be overridden in the prestart event.
Use a macro like this to force a side to have a particular type of leader.
#define MP_SIDE SIDENO TYPE DESC [store_unit] variable=oldunit kill=yes [filter] side={SIDENO} [/filter] [/store_unit] [unit] type={TYPE} description={DESC} unrenameable=yes side={SIDENO} x,y=$oldunit.x,$oldunit.y canrecruit=1 [/unit] [clear_variable] name=oldunit [/clear_variable] #enddef
Other useful tags include [set_recruit], [modify_side], [modify_turns] and [remove_shroud]. There is currently no way to remove fog. You might also want to use experience_modifier=100 in the [multiplayer] tag.
Custom units
Since there is no [campaign] tag, there is no natural way to include custom units in a multiplayer campaign. However, there are two workarounds. One way is to use EffectWML or [store_unit] to modify a mainline unit. The other way is to make your custom units available via an era, or by dropping them into ~wesnoth/data/units. If you go this route, using an era is better, because you can keep the units in your campaign directory.