Difference between revisions of "BuildingScenarios"

From The Battle for Wesnoth Wiki
m (Scenarios and the Map Editor)
(Quick Tag Index: Remove [tutorial])
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Translations}}
 +
{| style="float:right"
 +
|
 +
__NOTOC__
 +
|}
 +
 
{{Create}}
 
{{Create}}
  
 
<div class="thumb tright"><div>
 
<div class="thumb tright"><div>
[http://www.wesnoth.org/images/sshots/wesnoth-1.11.8-1.jpg http://www.wesnoth.org/images/sshots/wesnoth-1.11.8-1-175.jpg]
+
[https://www.wesnoth.org/images/sshots/wesnoth-1.11.8-1.jpg https://www.wesnoth.org/images/sshots/wesnoth-1.11.8-1-175.jpg]
 
<div class="thumbcaption">The Elves Besieged</div></div>
 
<div class="thumbcaption">The Elves Besieged</div></div>
 
</div>
 
</div>
  
Wesnoth scenarios are the individual levels within the game. Or they can be advanced multiplayer maps, with extra characters and items and such. Each scenario contains two files. First is the map itself, this is described in [[BuildingMaps]]. The second is the config file. This configuration file is used to describe everything about the scenario. Both of the files are ascii and can be edited in any standard text editor (vi, notepad, etc.) If you decide to use a wordprocessor, please make sure you remember to <i>Save As</i> text (preferably with a <i>.cfg</i> extension).
+
Wesnoth scenarios are the individual levels within the game. They can be as simple or advanced as you choose, ranging from two sides who must fight each other to multiple sides with different characters, custom items, and complicated events. This page is split into several sections, starting with the basics and moving into more complex techniques. When you're done, you should have all the knowledge necessary to create your own scenarios.
  
This document is split into several sections, starting with a basic tutorial and moving into more complex techniques. From the information contained within this document you should have all the knowledge to create Wesnoth scenarios.
+
Each scenario is made up of two files: the map file and the configuration file. The former, the map itself, is discussed in [[BuildingMaps]]. The latter describes everything about, and what occurs in, a scenario, from the setup of sides, units, music, events, and so on. Both files are plaintext are can be edited in any standard text editor. If you decide to use a wordprocessor, please make sure to <i>Save As</i> text (preferably with a <i>.cfg</i> extension), not as rich text.
  
Remember that you can use all of the standard scenario files for reference. Sometimes an example is what you really need anyways. Between the campaigns included with the distribution, probably a lot of the game engine features have been used.
+
Remember that you can use the scenarios that ship with the game for reference should you get stuck. They cover a wide range of techniques, so it's likely you'll find an example of what you need.
  
If you still don't understand something or can't get it to work, you can ask for assistance in the [http://forums.wesnoth.org/viewforum.php?f=23 WML Workshop].
+
If you still don't understand something or can't get it to work, feel free to ask for assistance in the [https://forums.wesnoth.org/viewforum.php?f=23 WML Workshop] on the forums.
  
 
== The Wesnoth Markup Language ==
 
== The Wesnoth Markup Language ==
  
Scenarios are written in the [[ReferenceWML | Wesnoth Markup Language]], a custom language written specially to work with the game. It sports a relatively simple tag/key-based syntax. A complete guide to the WML syntax can be found on the [[SyntaxWML]] page.
+
Scenarios are written in the [[ReferenceWML|Wesnoth Markup Language]] (WML), a custom language written specially to work with the game. It sports a relatively simple tag/key-based syntax, a complete guide to which can be found on the [[SyntaxWML]] page.
+
 
 
=== Quick Tag Index ===
 
=== Quick Tag Index ===
  
Below follows an index of tags WML supports, with descriptions on their usage and individual tag keys.
+
Below follows an index of the basic WML tags used to create scenarios.
  
:*[[ScenarioWML]] the top level tags [scenario], [multiplayer], [test], and [tutorial]
+
:* [[ScenarioWML]]: The top level tags [scenario], [multiplayer], and [test]
:* [[IntroWML]] how to describe the intro screen
+
:* [[IntroWML]]: Setting up the intro screen
:* [[TimeWML]] how to describe a day
+
:* [[TimeWML]]: Setting up the time schedule
:* [[SideWML]] how to describe a side
+
:* [[SideWML]]: Describing a side
:** [[SingleUnitWML]]
+
:** [[SingleUnitWML]]: The syntax of a single unit
:** [[BuildingScenariosShroudData]]
+
:** [[ShroudDataWML]]
:* [[EventWML]] how to describe an event
+
:* [[EventWML]]: An event that happens in the scenario
:** [[FilterWML]]
+
:** [[FilterWML]]: All about filters
 
:** [[DirectActionsWML]], [[InterfaceActionsWML]], [[InternalActionsWML]]
 
:** [[DirectActionsWML]], [[InterfaceActionsWML]], [[InternalActionsWML]]
:* [[MapGeneratorWML]] the random map generator
+
:* [[MapGeneratorWML]]: The random map generator
:* [http://www.wesnoth.org/macro-reference.xhtml Macro Reference] a set of useful macro shortcuts you can use
+
:* [https://www.wesnoth.org/macro-reference.html Macro Reference]: A set of useful macro shortcuts you can use
  
 
=== Sample Code ===
 
=== Sample Code ===
Line 41: Line 47:
  
 
<div class="thumb tright"><div>
 
<div class="thumb tright"><div>
[http://www.wesnoth.org/images/sshots/wesnoth-1.11.8-5.jpg http://www.wesnoth.org/images/sshots/wesnoth-1.11.8-5-175.jpg]
+
[https://www.wesnoth.org/images/sshots/wesnoth-1.11.8-5.jpg https://www.wesnoth.org/images/sshots/wesnoth-1.11.8-5-175.jpg]
 
<div class="thumbcaption">Scenario Data</div></div>
 
<div class="thumbcaption">Scenario Data</div></div>
 
</div>
 
</div>
Line 51: Line 57:
 
<b>NOTE: Scenario-specific content will not be saved unless you also select the <i>File → Save Scenario</i> option before exit. Otherwise, you will simply get a map file.</b>
 
<b>NOTE: Scenario-specific content will not be saved unless you also select the <i>File → Save Scenario</i> option before exit. Otherwise, you will simply get a map file.</b>
  
== Building your scenario ==
+
== Building Your Scenario ==
  
 
:<b>• [[BuildingScenariosSimple|Simple]] • [[BuildingScenariosIntermediate|Intermediate]] • [[BuildingScenariosAdvanced|Advanced]]</b>
 
:<b>• [[BuildingScenariosSimple|Simple]] • [[BuildingScenariosIntermediate|Intermediate]] • [[BuildingScenariosAdvanced|Advanced]]</b>
Line 57: Line 63:
 
Creating a scenario is no simple task. Generally, you should have a premise mapped out for the scenario before you begin. Who will your protagonists face? What events will occur? How long will it be? You might decide to revise your plans as you code and test them. It will generally take many iterations of writing, coding, and playtesting until your scenario reaches a product you are satisfied with.
 
Creating a scenario is no simple task. Generally, you should have a premise mapped out for the scenario before you begin. Who will your protagonists face? What events will occur? How long will it be? You might decide to revise your plans as you code and test them. It will generally take many iterations of writing, coding, and playtesting until your scenario reaches a product you are satisfied with.
  
A discussion on tweaking and balancing your scenario to make it more fun is found on the [[BuildingScenariosBalancing|Balancing]] page. ESR has more handy tips in his [http://catb.org/~esr/wesnoth/campaign-design-howto.html Campaign Design How-To] article, and as mentioned before, don't hesitate to ask for help in the [http://forums.wesnoth.org/viewforum.php?f=23 WML Workshop].
+
A discussion on tweaking and balancing your scenario to make it more fun is found on the [[BuildingScenariosBalancing|Balancing]] page. ESR has more handy tips in his [http://catb.org/~esr/wesnoth/campaign-design-howto.html Campaign Design How-To] article, and as mentioned before, don't hesitate to ask for help in the [https://forums.wesnoth.org/viewforum.php?f=23 WML Workshop].
  
 
A handy breakdown of the code of a scenario, line-by-line, is available on the three pages linked here. Each explores gradually more complex WML concepts.
 
A handy breakdown of the code of a scenario, line-by-line, is available on the three pages linked here. Each explores gradually more complex WML concepts.
Line 64: Line 70:
  
 
* [[ReferenceWML]] - WML master reference
 
* [[ReferenceWML]] - WML master reference
* [[AlphabeticalWML]] - a tag index
 
* [[BuildingScenariosIndex]] - in-depth key and tag index
 

Latest revision as of 12:46, 14 April 2023


wesnoth-1.11.8-1-175.jpg

The Elves Besieged

Wesnoth scenarios are the individual levels within the game. They can be as simple or advanced as you choose, ranging from two sides who must fight each other to multiple sides with different characters, custom items, and complicated events. This page is split into several sections, starting with the basics and moving into more complex techniques. When you're done, you should have all the knowledge necessary to create your own scenarios.

Each scenario is made up of two files: the map file and the configuration file. The former, the map itself, is discussed in BuildingMaps. The latter describes everything about, and what occurs in, a scenario, from the setup of sides, units, music, events, and so on. Both files are plaintext are can be edited in any standard text editor. If you decide to use a wordprocessor, please make sure to Save As text (preferably with a .cfg extension), not as rich text.

Remember that you can use the scenarios that ship with the game for reference should you get stuck. They cover a wide range of techniques, so it's likely you'll find an example of what you need.

If you still don't understand something or can't get it to work, feel free to ask for assistance in the WML Workshop on the forums.

The Wesnoth Markup Language

Scenarios are written in the Wesnoth Markup Language (WML), a custom language written specially to work with the game. It sports a relatively simple tag/key-based syntax, a complete guide to which can be found on the SyntaxWML page.

Quick Tag Index

Below follows an index of the basic WML tags used to create scenarios.

Sample Code

A nice collection of simple beginner code to look at is documented on the Samples page, showcasing the basic usage and structure of WML in an actual coding sense.

Scenarios and the Map Editor

wesnoth-1.11.8-5-175.jpg

Scenario Data

As of Wesnoth 1.12, the Map Editor has become more fully featured, and includes options to define more basic scenario-related content for your scenario, such as name, unit placement, graphical items, time of day schedules, etc, without having to manually write the code yourself. However, the editor cannot create more complex WML. Those interesting snippets still have to be written by hand. These functions are most useful for creating a simple scenario from a map, or streamlining your workflow in creating a more complicated scenario.

In order to edit scenario metadata, select File → New Scenario. By default, the editor opens with a blank map file open only.

NOTE: Scenario-specific content will not be saved unless you also select the File → Save Scenario option before exit. Otherwise, you will simply get a map file.

Building Your Scenario

SimpleIntermediateAdvanced

Creating a scenario is no simple task. Generally, you should have a premise mapped out for the scenario before you begin. Who will your protagonists face? What events will occur? How long will it be? You might decide to revise your plans as you code and test them. It will generally take many iterations of writing, coding, and playtesting until your scenario reaches a product you are satisfied with.

A discussion on tweaking and balancing your scenario to make it more fun is found on the Balancing page. ESR has more handy tips in his Campaign Design How-To article, and as mentioned before, don't hesitate to ask for help in the WML Workshop.

A handy breakdown of the code of a scenario, line-by-line, is available on the three pages linked here. Each explores gradually more complex WML concepts.

See Also

This page was last edited on 14 April 2023, at 12:46.