Difference between revisions of "MultiplayerContent"

From The Battle for Wesnoth Wiki
(Fixed out of date info.)
(Merged two sections, changed header levels)
Line 1: Line 1:
 
'''Multiplayer campaigns are working again in versions 1.3.5+''', they are broken in both stable and development versions of Wesnoth prior to 1.x.5. Check the [http://www.wesnoth.org/forum/viewtopic.php?t=11349 forums] for more information.
 
'''Multiplayer campaigns are working again in versions 1.3.5+''', they are broken in both stable and development versions of Wesnoth prior to 1.x.5. Check the [http://www.wesnoth.org/forum/viewtopic.php?t=11349 forums] for more information.
  
== Building multiplayer campaigns ==
+
= Building multiplayer campaigns =
  
 
Both the stable and development versions of wesnoth have basic support for campaigns that can be played in multiplayer mode, with your friends, or even with an AI.  There will still be some things that don't work as expected as multiplayer campaigns are an area for exploration. While you can and should test your work in hotseat mode, there are a number of things that might behave differently under real network conditions (mostly affecting scenario and side parameters). Keep this in mind and make sure to test your campaign over the net, too.
 
Both the stable and development versions of wesnoth have basic support for campaigns that can be played in multiplayer mode, with your friends, or even with an AI.  There will still be some things that don't work as expected as multiplayer campaigns are an area for exploration. While you can and should test your work in hotseat mode, there are a number of things that might behave differently under real network conditions (mostly affecting scenario and side parameters). Keep this in mind and make sure to test your campaign over the net, too.
 
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.
 
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 ===
+
== 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:
 
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:
Line 12: Line 12:
 
  #ifdef MULTIPLAYER
 
  #ifdef MULTIPLAYER
 
  {@campaigns/My_Campaign/scenarios}
 
  {@campaigns/My_Campaign/scenarios}
 +
 +
#Only needed if you have custom units
 +
[+units]
 +
    {@campaigns/My_Campaign/units}
 +
[/units]
 
  #endif
 
  #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.
 
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 ===
+
== 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:
 
A scenario in a multiplayer campaign is almost identical to a scenario in a single player campaign. You only need to change the following:
Line 30: Line 35:
 
* If you have a file containing macros, it must be referenced by every scenario, since there is no proper campaign file to include it from.
 
* If you have a file containing macros, it must be referenced by every scenario, since there is no proper campaign file to include it from.
  
=== The first scenario ===
+
== 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.
 
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.
Line 59: Line 64:
  
 
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.
 
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 ===
 
 
If you have any custom units, you can include them from the campaign file. It will look something like this:
 
 
#ifdef MULTIPLAYER
 
{@campaigns/My_Campaign/scenarios}
 
 
[+units]
 
    {@campaigns/My_Campaign/units}
 
[/units]
 
#endif
 
  
 
== See Also ==
 
== See Also ==

Revision as of 23:54, 16 January 2009

Multiplayer campaigns are working again in versions 1.3.5+, they are broken in both stable and development versions of Wesnoth prior to 1.x.5. Check the forums for more information.

Building multiplayer campaigns

Both the stable and development versions of wesnoth have basic support for campaigns that can be played in multiplayer mode, with your friends, or even with an AI. There will still be some things that don't work as expected as multiplayer campaigns are an area for exploration. While you can and should test your work in hotseat mode, there are a number of things that might behave differently under real network conditions (mostly affecting scenario and side parameters). Keep this in mind and make sure to test your campaign over the net, too. 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}

#Only needed if you have custom units
[+units]
    {@campaigns/My_Campaign/units}
[/units]
#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.
  • The next_scenario key points to the id of the next scenario.
  • 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.
  • Each human-controlled side needs to have a controller=human key defined in their [side] tag to work in network mode.
  • Each human-controlled side also 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 human-controlled side has to have a leader type= definition in every scenario except the first one . It doesn't matter which type you choose cause the type set here gets replaced by the actual leader in the recall list.
  • Each AI-controlled side should have allow_player=no in their [side] tag.
  • The [story] tag will only display for the first player (or maybe it's the host player). You'll have to use [message] tags in the start event if you want everyone to read the story.
  • If you have a file containing macros, it must be referenced by every scenario, since there is no proper campaign file to include it from.

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=yes
        [/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.

See Also