Make your Map Pack

From The Battle for Wesnoth Wiki

This is a step-by-step guide showing how users can get their custom made maps converted to scenarios, and then compile those scenarios into a map-pack add-on, ready for release! I shall to be as concise as possible, providing images to help understand.

For this guide, the process will be done with Battle for Wesnoth 1.15.11 which is the version I have installed right now, but the process is the same for every version.

Things to Consider

The Approach

This is about how you are making the maps/scenarios. Are you using the in-game map editor to make your maps? Or, are you taking it a step further and making the complete scenario using the map-editor's scenario editor? Or, are you determined to just code it entirely using the MapGeneratorWML? Hey, we are covering all three!

The Procedures

This section covers the Step-by-Step guides.

Method One - the Map Editor

  • Make your desired Map. Refer to BuildingMaps if you want further info.
  • Assign player positions
  • Save your Map. Give it a cool or immersive name. Remember to save once every 5 minutes or so while making your map because you get a power outage, crash, or whatever, you probably won't be able to restore any changes made. It is good practice to save while map-making.
  • Open your add-ons folder. Refer to this page if you are not sure where it is.
  • For our guide, we shall be making an add-on titled Sample Map Pack.
  • For this guide, I shall be using one of my maps, Sylvan Refuge as a sample.
  • In the add-ons folder, make a new directory (or new folder) named Sample_Map_Pack. Please note the underscores and the uppercase and lowercase alphabets. You would have to keep them constant when you start the actual coding stuff.
  • Go inside (open it) this folder/directory and make subdirectories (more new folders) named maps and scenarios. If you want translations as well, make a translations directory/folder as well. We shall cover this at a later section.
  • It is recommended you use a specialised text editor for the next steps. For this guide, we are using Visual Studio Code. I know most of you can use Notepad/TextEdit for this, which is perfectly fine, but when you start getting errors and those text editors are helpless in telling where you did the typo, you shall start appreciating VSCode or Kate. #BeenThereDoneThat
  • Now to code the files which shall make it an add-on.
  • The _main.cfg file:
#textdomain wesnoth-Sample_Map_Pack

# these are textdomains
# simply put, if you want your maps to be translated
# into other languages, then you add this
[textdomain]
    name="wesnoth-Sample_Map_Pack"
    path="data/add-ons/Sample_Map_Pack/translations"
[/textdomain]

#ifdef MULTIPLAYER
# indicate the binary path
# this will Wesnoth find your maps
# for the map_file= key
[binary_path]
    path=data/add-ons/Sample_Map_Pack
[/binary_path]

# load the scenarios
{~add-ons/Sample_Map_Pack/scenarios}
#endif

  • The scenario file inside the scenarios, named as 2p_Sylvan_Refuge.cfg. Please note that CFG file extension is paramount and any other format shall not be recognised.
#textdomain wesnoth-Sample_Map_Pack
[multiplayer]
    id="2p_Sylvan_Refuge"
    name= _ "2p - Sylvan Refuge"

    description= _ "1v1 Map made by Lord-Knightmare."
    map_file=2p_Sylvan_Refuge.map

    turns=-1
    random_start_time=yes
    victory_when_enemies_defeated=yes

    {DEFAULT_SCHEDULE}
    {DEFAULT_MUSIC_PLAYLIST}

    # Note: I would keep the side definitions
    # as simple as possible to avoid
    # some issues where the faction is not 
    # selectable or so
    
    [side]
        side=1
        team_name="one"
        user_team_name= _ "South"
        {FLAG_VARIANT long}
        gold=100
        income=1
    [/side]

    [side]
        side=2
        team_name="two"
        user_team_name= _ "North"
        {FLAG_VARIANT long}
        gold=100
        income=1
    [/side]
[/multiplayer]

  • Okay, assuming you have followed the instructions properly, the add-on should be loading without any errors. You know what that means, right? You did it! Now, head over to PBLWML and get it on the add-ons server!

Method Two - the Scenario Editor

  • Make whatever scenario you feel like with the in-game scenario editor. I cannot really explain this as you have let your own creativity shine here. We shall move to the next steps.
  • In the add-ons folder, make a new directory (or new folder) named Sample_Map_Pack. Please note the underscores and the uppercase and lowercase alphabets. You would have to keep them constant when you start the actual coding stuff.
  • Go inside (open it) this folder/directory and make subdirectories (more new folders) named maps and scenarios. If you want translations as well, make a translations directory/folder as well. We shall cover this at a later section.

The difference between methods one and two starts here. Make a new directory utils inside the Sample_Map_Pack directory.

  • It is recommended you use a specialised text editor for the next steps. For this guide, we are using Visual Studio Code. I know most of you can use Notepad/TextEdit for this, which is perfectly fine, but when you start getting errors and those text editors are helpless in telling where you did the typo, you shall start appreciating VSCode or Kate. #BeenThereDoneThat
  • Now to code the files which shall make it an add-on.
  • The _main.cfg file:
#textdomain wesnoth-Sample_Map_Pack

# these are textdomains
# simply put, if you want your maps to be translated
# into other languages, then you add this
[textdomain]
    name="wesnoth-Sample_Map_Pack"
    path="data/add-ons/Sample_Map_Pack/translations"
[/textdomain]

#ifdef MULTIPLAYER
# indicate the binary path
# this will Wesnoth find your maps
# for the map_file= key
[binary_path]
    path=data/add-ons/Sample_Map_Pack
[/binary_path]

# load the scenarios
{~add-ons/Sample_Map_Pack/scenarios}
#endif

  • Find the scenario file that was generated by the editor. It should be inside the userdata directory's editor/scenarios folder. Copy this to the utils folder nside the Sample_Map_Pack.
  • The scenario file inside the scenarios, named as 2p_Sylvan_Refuge_M2.cfg. Please note that CFG file extension is paramount and any other format shall not be recognised.
[multiplayer]
    # most of things are in the generated file
    # and we should not edit this by hand in any way
    # this is important
    {~add-ons/Sample_Map_Pack/utils/2p_Sylvan_Refuge_utils.cfg}

    # only do these if you want to override the ones generated by the scenario editor
    id="2p_Sylvan_Refuge_scenario_editor_sample"
    name= _ "2p - Sylvan Refuge"
    description= _ "1v1 Map made by Lord-Knightmare using the in-game scenario editor."
[/multiplayer]

  • Most of the code is in the CFG file which was generated by the editor so, you just need to put it in as a multiplayer scenario. It should load flawlessly.
  • Okay, assuming you have followed the instructions properly, the add-on should be loading without any errors. You know what that means, right? You did it! Now, head over to PBLWML and get it on the add-ons server!

Extras

I shall probably fill this section with something soon.

This page was last edited on 23 March 2021, at 18:20.