Viliam Búr

2008/07/27

Water Battle Map for Wesnoth, Published

In previous article we have designed a map for water battle, called "2p_Pool.map". Now we will specify that players can only recruit Merfolk and Naga units. And then we will publish the map on the Wesnoth add-on server, so that other people can download it and play against each other online.

In map editor we can only place terrains and starting positions. For anything else we must create a configuration file. It is a text file. And by "text file" I mean text file created with plain text editor such as Notepad or KWrite. Not Word document, nor RTF document, just good old "*.txt" file. And it looks like this:

[multiplayer]

 id=multiplayer_2p_Pool
 name= _ "2p - Pool"
 description= _ "Fight in water between merfolk and nagas."
 map_data="{@campaigns/Examples_by_Viliam/maps/multiplayer/2p_Pool.map}"

 {DEFAULT_SCHEDULE}
 {DEFAULT_MUSIC_PLAYLIST}

 [side]
  side=1
  controller=human

  team_name=west
  user_team_name= _ "teamname^West"

  canrecruit=yes
  recruit=Merman Fighter,Merman Hunter,Mermaid Initiate

 [/side]

 [side]
  side=2
  controller=human

  team_name=east
  user_team_name= _ "teamname^East"

  canrecruit=yes
  recruit=Naga Fighter,Saurian Augur,Saurian Skirmisher

 [/side]

[/multiplayer]

Do not be afraid. It is easy to understand, when you try. The configuration file is basicly a list of "keyword=value" pairs. Sometimes they are surrounded by marks like "[multiplayer]" and "[/multiplayer]", or "[side]" and "[/side]". You can learn their meanings (keep a cheat sheet at hand), or just copy this example and try to change the ones you understand.

The "[multiplayer]" and "[/multiplayer]" marks mean "this is the beginning / the end of multiplayer scenario description". The "id" is an internal scenario identifier; it means that nobody will read this text, but it has to be different from the "id"s of other scenarios. The "name" is a name under which the scenario will appear in a map list. Tradition says that the name should also show how many players can play the scenario, therefore "2p - Pool". The "description" will appear when you move the mouse cursor above the map preview. The "map_data" is a link to map file created in map editor.

(C) 2008 Viliam Búr viliambur.blogspot.com

The symbols "{DEFAULT_SCHEDULE}" and "{DEFAULT_MUSIC_PLAYLIST}" are just shortcuts (called macros) for something more complicated. This means that we will use standard day/night schedule, and standard music playlist. We have no reason to change this now.

The "[side]" and "[/side]" marks mean "this is the beginning / the end of side description". We have two sides, and we have put two starting positions in the map. The "side" is just an order of side, 1 or 2. The "controller" means that this side can be played by human player (but we can choose computer player instead). The "team_name" is a team identifier; the "user_team_name" is how the team name will be displayed to player, so that s/he knows s/he will play for the West team or the East team. The "canrecruit" says that players can recruit units at keeps. And the "recruit" is a comma-separated list of recruitable units. (You will find the units in "data/core/units" directory, where "data" means "C:\Program Files\Wesnoth 1.4.4\data" or something similar. Look at the text files and find the "id".)

The symbol "_" before some texts means that these texts are translatable to other languages. We will not do it now, but it is a good habit to write the "_" symbol before all strings which will be displayed to player. The part of texts before symbol "^" in translated strings will not be displayed; it is just a hint for translators.

Now we need to put the map file "2p_Pool.map" and the scenario configuration file "2p_Pool.cfg" somewhere where the game finds them, and make them link to each other correctly. Because I want to publish my examples in one package, I have created a directory "userdata/data/campaigns/Examples_by_Viliam". (This is not a campaign, but the game add-on server supports campaigns, so we are going to cheat a little.) Inside this directory I put the map file as "maps/multiplayer/2p_Pool.map" and the scenario file as "scenarios/multiplayer/2p_Pool.cfg". Please note how the "map_data" value in scenario configuration file points to the map file. If you want to use different directories, you have to change the link.

To make this package visible to game, we need another configuration file "userdata/data/campaigns/Examples_by_Viliam.cfg". It will be like this:

#ifdef MULTIPLAYER
{@campaigns/Examples_by_Viliam/scenarios/multiplayer}
#endif

The package configuration file will include the subdirectory "scenarios/multiplayer" if the game is in the multiplayer mode. No need to waste memory if the player is doing something different. And we will need a publishing file "userdata/data/campaigns/Examples_by_Viliam.pbl" like this:

title="Examples by Viliam"
version="0.0.1"
author="Viliam Bur"
passphrase="i_will_not_show_you_my_password__make_your_own"
description="WML examples. I hope this works..."

Now when we start the game and select the "Add-ons" menu, there will be a list of downloadable packages, and also an option to publish this package. I did it... so if anything in this tutorial was not clear, you can just download "Examples by Viliam" and look at the files on your own disk.

If you have any questions about this example, or if you found it useful, please write me a comment here. If you have more questions about creating Wesnoth content, please register into Wesnoth forum and ask there. There are many people in the forum willing to help, if you behave politely and try to search the web page before asking.

Related articles:

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home