BuildingMultiplayer
From Wesnoth
Contents |
Introduction
Many players want to be able to create and distribute maps or single scenarios without getting into all of that campaign stuff. So this page has what you need to know with all of the other stuff taken out. This means it might be somewhat redundant, but it gives us the opportunity to address some multiplayer concerns in detail.
Map-only files
Here is an example of a pure map data file. It is a rectangle of letters (and punctuation symbols), and each letter (or punctuation symbol) signifies a particular terrain. When you create a map with the map editor, this is what you get. Maps of this type should be placed in userdata/editor/maps, and they will show up on the list of playable maps in the multiplayer screen.
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Gg, Gg, Gg, Gg^Ve, Gg, Hh, Gg
Gs^Fp, Gs^Fp, Gg, Gg, Gg, Mm, Gs^Fp
Hh, Hh, Mm, Gg, Gg, Gg, Re
Gs^Fp, Gs^Fp, Hh, Gg, Re, Re, Gg
Mm, Mm, Gg^Vh, Re, Gg, Gg, Gg^Vh
Hh, Hh, Gg, Re, Gs^Fp, Gg, Hh
Gs^Fp, Gs^Fp, Gs^Fp, Re, Gs^Fp, Hh, Wwf
Mm, Mm, Hh, Re, Mm, Mm, Ww
Gs^Fp, Gs^Fp, Wwf, Re, Hh, Hh, Ww
Wwf, Wwf, Ww, Re, Gs^Fp, Gg, Gg
Re, Re, Ww, Re, Wwf, Gg, Mm
Re, Re, Re, Ww^Bw|, Wwf, Gs^Fp, Ss
Hh, Hh, Gg, Re, Re, Hh, Gs^Fp
Gg, Gg, Gg^Ve, Re, Gs^Fp, Mm, Ss
Gg, Gg, Re, Re, Re, Hh, Ss
Re, Re, Gg, Gg, Gg^Vh, Re, Re
Gs^Fp, Gs^Fp, Hh, Gg, Gg, Gg, Mm
Hh, Hh, Gg^Ve, Gg, Hh, Gs^Fp, Hh
Mm, Mm, Hh, Gs^Fp, Mm, Gs^Fp, Wwf
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww
Multiplayer Scenario Files
QUESTION: How do I add units or items to my map? Is this even possible? ANSWER: Yes, but it's not trivial. Making maps is easy. Adding stuff is much harder. Neither the map editor nor campgen is appropriate for what you want to do. You need to use WML to create a map scenario file. Here is an example. It's the scenario code for Blitz:
[multiplayer]
id=multiplayer_Blitz
name= _ "2p - Blitz"
map_data="{maps/multiplayer/2p_Blitz}"
description= _ "A duel map for super fast play. Recommended setting of 2 gold per village."
{DEFAULT_SCHEDULE}
[side]
side=1
canrecruit=yes
controller=human
team_name=north
[/side]
[side]
side=2
canrecruit=yes
controller=human
team_name=south
[/side]
[/multiplayer]
It comes straight from wesnoth/data/scenarios/multiplayer/2p_Blitz.cfg.
In order to put things on the map, you need to create a scenario file like the one I posted at the top. I will now merge the example map data with the scenario file. Note the location of the quotation marks in map_data:
[multiplayer] id=multiplayer_retlin name= _ "Retlin's Awesome Map" map_data="border_size=1 usage=map
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Gg, Gg, Gg, Gg^Ve, Gg, Hh, Gg
Gs^Fp, Gs^Fp, Gg, Gg, Gg, Mm, Gs^Fp
Hh, Hh, Mm, Gg, Gg, Gg, Re
Gs^Fp, Gs^Fp, Hh, Gg, Re, Re, Gg
Mm, Mm, Gg^Vh, Re, Gg, Gg, Gg^Vh
Hh, Hh, Gg, Re, Gs^Fp, Gg, Hh
Gs^Fp, Gs^Fp, Gs^Fp, Re, Gs^Fp, Hh, Wwf
Mm, Mm, Hh, Re, Mm, Mm, Ww
Gs^Fp, Gs^Fp, Wwf, Re, Hh, Hh, Ww
Wwf, Wwf, Ww, Re, Gs^Fp, Gg, Gg
Re, Re, Ww, Re, Wwf, Gg, Mm
Re, Re, Re, Ww^Bw|, Wwf, Gs^Fp, Ss
Hh, Hh, Gg, Re, Re, Hh, Gs^Fp
Gg, Gg, Gg^Ve, Re, Gs^Fp, Mm, Ss
Gg, Gg, Re, Re, Re, Hh, Ss
Re, Re, Gg, Gg, Gg^Vh, Re, Re
Gs^Fp, Gs^Fp, Hh, Gg, Gg, Gg, Mm
Hh, Hh, Gg^Ve, Gg, Hh, Gs^Fp, Hh
Mm, Mm, Hh, Gs^Fp, Mm, Gs^Fp, Wwf
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww"
description= _ "This will be my own super cool map with lots of extra units."
{DEFAULT_SCHEDULE}
[side]
side=1
canrecruit=yes
controller=human
team_name=north
[/side]
[side]
side=2
canrecruit=yes
controller=human
team_name=south
[/side]
[/multiplayer]
If you save that as a .cfg file in your userdata/data/campaigns directory, it will show up on the list of maps you can play in multiplayer.
The hard part is past us. Understanding how information is stored and the various forms map data can take are key steps. The game recognizes both types of files - the pure map data only, i.e. the rectangle of characters in the text file, as well as the map data wrapped in [multiplayer] tags to create a scenario file.
Now that you have a functioning scenario file for your multiplayer map, you can use WML to add anything you want to it. The WML to add a unit to the map looks like this:
[event] name=prestart [unit] type=Spearman x,y=10,10 side=1 [/unit] [/event]
Most actions should be placed inside an event. There is a long list of things you can do inside events, and [unit] creates a unit. Now all you have to do is stick the WML anywhere inside the scenario file. Here is the final scenario file:
[multiplayer] id=multiplayer_retlin name= _ "Retlin's Awesome Map" map_data="border_size=1
usage=map
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Hh, Hh, Gg, Gs^Fp, Gs^Fp, Hh, Mm
Gg, Gg, Gg, Gg^Ve, Gg, Hh, Gg
Gs^Fp, Gs^Fp, Gg, Gg, Gg, Mm, Gs^Fp
Hh, Hh, Mm, Gg, Gg, Gg, Re
Gs^Fp, Gs^Fp, Hh, Gg, Re, Re, Gg
Mm, Mm, Gg^Vh, Re, Gg, Gg, Gg^Vh
Hh, Hh, Gg, Re, Gs^Fp, Gg, Hh
Gs^Fp, Gs^Fp, Gs^Fp, Re, Gs^Fp, Hh, Wwf
Mm, Mm, Hh, Re, Mm, Mm, Ww
Gs^Fp, Gs^Fp, Wwf, Re, Hh, Hh, Ww
Wwf, Wwf, Ww, Re, Gs^Fp, Gg, Gg
Re, Re, Ww, Re, Wwf, Gg, Mm
Re, Re, Re, Ww^Bw|, Wwf, Gs^Fp, Ss
Hh, Hh, Gg, Re, Re, Hh, Gs^Fp
Gg, Gg, Gg^Ve, Re, Gs^Fp, Mm, Ss
Gg, Gg, Re, Re, Re, Hh, Ss
Re, Re, Gg, Gg, Gg^Vh, Re, Re
Gs^Fp, Gs^Fp, Hh, Gg, Gg, Gg, Mm
Hh, Hh, Gg^Ve, Gg, Hh, Gs^Fp, Hh
Mm, Mm, Hh, Gs^Fp, Mm, Gs^Fp, Wwf
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww
Gs^Fp, Gs^Fp, Gs^Fp, Ss, Gs^Fp, Wwf, Ww"
description= _ "This will be my own super cool map with lots of extra units."
{DEFAULT_SCHEDULE}
[side]
side=1
canrecruit=yes
controller=human
team_name=north
[/side]
[side]
side=2
canrecruit=yes
controller=human
team_name=south
[/side]
[event]
name=prestart
[unit]
type=Spearman
x,y=10,10
side=1
[/unit]
[/event]
[/multiplayer]
That should do it. Good luck. Here is a page with examples for map builders.
Packaging it for distribution
You have several options for distributing your maps.
- Post the config file, map data file, or map pack (a zip archive of many files) on the forum
- Post the config file on the campaign server
The first option is pretty easy to do. If you want players everywhere to be able to download your map from the in-game server, once again the problem gains several levels of complexity. You have to package just like a campaign so the game knows that it can be published. The best thing to do is download one of the existing MP eras and copy its format.
Posting on the forum
The only point of this section is to inform you that a very effective method of distributing your work is by posting it on the forum. It is very active, and you are likely to get some good feedback on your map.
See Also
