Campaign Creation Team

General feedback and discussion of the game.

Moderator: Forum Moderators

User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Campaign Creation Team

Post by beetlenaut »

Implementor37 wrote:If you have this campaign in the same folder as the rest of your add-ons, it will show up in Wesnoth under the 'campaigns' tab just like anything else
The file containing this code should also be named _main.cfg if it isn't already.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: Campaign Creation Team

Post by Groggy_Dice »

The difficulties should be in all caps, I think.

The Campaign Design How-To is very good, but it's meant to be a guide to the "big picture", not the nitty-gritty of coding WML. I can see why it doesn't seem so helpful to you right now, but keep its advice in mind as you move forward.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
User avatar
Xara
Posts: 270
Joined: December 26th, 2014, 12:23 am
Location: Beijing

Re: Campaign Creation Team

Post by Xara »

I myself find the UMC Campaign "The Final Exam" very helpful with code learning. Better than Campaign How-to, imo.
It pronounces Sha'ha, not Zara.

Feedback Thread of my Add-ons
Peacekhan
Posts: 11
Joined: March 14th, 2015, 9:28 pm

Re: Campaign Creation Team

Post by Peacekhan »

Thanks, I hadn't heard of the final exam before, and Ill go back and redo the difficulties to be in all caps.

*Edit*

Ok so I just tried changing the save file to _main.cfg and my computer said I didn't have permission to save there and I needed to get permission first. Whats up with that?
User avatar
Implementor37
Posts: 121
Joined: February 22nd, 2015, 12:41 am
Location: The Internet

Re: Campaign Creation Team

Post by Implementor37 »

Windows won't let you save directly to a Program Files folder, even if you have an admin account. Just move the file outside the Program Files, change the name, and move it back. Also, double check that your campaign is in the userdata/data/add-ons/ directory and not data/core/campaigns. (There are 2 possible locations for the add-ons folder on Windows: C:/Users/<UserName>/AppData/Local/VirtualStore/Program Files(x86)/Battle for Wesnoth/userdata/data/add-ons and C:/Program Files (x86)/Battle for Wesnoth/userdata/data/add-ons/ You can directly edit the files within the AppData location, but if your userdata folder is inside Program Files you will have to move the file in order to rename and/or save it.
Author of End of the Legion, available now on the 1.12 and 1.13 servers!
Supporter of the addition of the Aragwaithi into mainline.
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Campaign Creation Team

Post by Ravana »

I find it most comfortable to install wesnoth to desktopbased folder with userdata in install location. No need to bother with hidden and restricted folders then.
Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: Campaign Creation Team

Post by Groggy_Dice »

Groggy_Dice wrote:The Campaign Design How-To is very good, but it's meant to be a guide to the "big picture", not the nitty-gritty of coding WML. I can see why it doesn't seem so helpful to you right now, but keep its advice in mind as you move forward.
OOPS!!! Everyone here has been using " Campaign How-To" to refer to "A Simple Campaign", not the CDHT. That's something else. It's something you should read eventually, but right now you're probably busy learning the basics.

There are some other mistakes you made. In part this is because the page beetlenaut sent you to concentrates on the scenario file, and the _main.cfg is an afterthought. Also, it is rather dated. (It tells you to put the file in "userdata/data/campaigns", which is wrong. First, only Windows users who chose to have the userdata folder put in the install directory will have a "userdata/" folder. Everyone else has a userdata folder, but it's not called "userdata/". Second, the addons folder has been renamed from "/campaigns" to "/add-ons".) You should look to the more detailed page it points you to (http://wiki.wesnoth.org/BuildingCampaig ... mpaignFile).

You left out the underscore after the "name=" key. That tells Wesnoth that the text is translatable. More seriously, you don't have an "id=" key at all, because the example on that wiki page didn't have one. I'm not sure it will even work without an id key. In case you're wondering what the difference is, id is what the program uses internally to identify your campaign, while name is the title displayed to the user, and can differ depending on the translation.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Campaign Creation Team

Post by beetlenaut »

Groggy_Dice wrote:OOPS!!! Everyone here has been using " Campaign How-To" to refer to "A Simple Campaign", not the CDHT.
I know the wiki is dated, which is why I recommended A Simple Campaign originally, but that has been renamed on the add-on server to "Campaign How-To (A Simple Campaign)", which is how I referred to it. The Campaign Design How-To is a document, and not what I meant. I have never looked at Final Exam, but maybe it's better.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Implementor37
Posts: 121
Joined: February 22nd, 2015, 12:41 am
Location: The Internet

Re: Campaign Creation Team

Post by Implementor37 »

Out of curiosity, how hard would it be to update the wiki? Perhaps its time we updated the wiki pages dealing with the basic campaign creation (BuildingCampaigns), as it carries the following information on how to set-up a campaign:
wiki.wesnoth.org/BuildingCampaigns wrote:Setting up the campaign

wesnoth-campaigns-menu-1.11.11-175.jpg

The South Guard
Technically, a campaign is simply a string of scenarios with next_scenario=id keys in toplevel (see BuildingScenarios), where the value of id is in the key of the same name in toplevel. This allows each one to load the next. But how to begin playing? By setting up a [campaign] tag in your _main.cfg.
The [campaign] tag is like the campaign's "cover". It will display your work in the campaign selection dialog with a description, an image (as shown on the right), as well as allowing the user to select a difficulty level before beginning to play.
It should be placed in your _main.cfg outside any preprocessor conditionals
For the #ifdef conditional, you should use the format #ifdef YOUR_DEFINE_HERE (you may define one in [campaign]).
The full syntax of the [campaign] tag is documented in CampaignWML, and an example of a fully featured _main.cfg with one in use can be found on the BuildingCampaignsTheCampaignFile page. If you run into errors while putting things together, DebuggingCampaigns has a few tips.
Note: By default, you will find your campaign in the singleplayer selection menu. If you intend to create a multiplayer campaign, see MultiplayerContent for the required syntax amendments.
This is very little information on how to set-up a campaign. It does reference BuildingCampaignsTheCampaignFile, but there should still probably be a sample directly within the main campaign-creation page. The WML Eclipse Plug-in will fill in the following information for you when you create a new campaign (this is a generated _main.cfg file):

Code: Select all

[textdomain]
    name="wesnoth-MyCampaign"
	# translations directory path
#    path=""
[/textdomain]

[campaign]
	#textdomain wesnoth-MyCampaign
	id=MyCampaign
	name= _ "MyCampaign"
	abbrev="MC"
	define="MyCampaign"

	icon= /units/random-unit.png
	description= _ "Your Campaign Description"
	difficulties=EASY,NORMAL,HARD

	first_scenario=MyFirstScenario

[/campaign]

#ifdef MyCampaign
	# add here custom code
	{~add-ons/MyCampaign/scenarios}
	[+units]
		{~add-ons/MyCampaign/units}
	[/units]
#endif
Perhaps something like this should make its way into the wiki? (By the way, thanks to the DevTeam for starting to update the wiki with the new 1.11+ documentation--some of those pages (especially multiplayer scenarios/campaign needed to be re-done badly. Thanks for finally getting around to it!))
Author of End of the Legion, available now on the 1.12 and 1.13 servers!
Supporter of the addition of the Aragwaithi into mainline.
Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: Campaign Creation Team

Post by Groggy_Dice »

To return to the subject of the translatability underscore: you won't have working translations, because that wiki example didn't show you how to set up the textdomain. True, most add-ons are never translated, and unless you know a foreign language yourself, yours definitely won't be until it's uploaded. But you should still create the textdomain and use the translatability underscores.

Seriously, you should go to the more detailed wiki page for your _main.cfg. That page is also a bit out of date ("The only exception to this is the [binary_path] tag specifying the path to custom images in your campaign, but you should only put this outside the #ifdef if you need custom images for the campaign selection menu and the difficulty selection menu. Otherwise even this belongs inside the #ifdef." NO, these days you should never have a binary path outside the #ifdef.), but you really need to learn more about the _main.cfg file.

Of course, you should also be reading the _main.cfg from "A Simple Campaign" (you do realize that the point of downloading ASC is to read its comments, right?). Some authors also use ASC's files as a template, substituting their desired values for the ones in ASC. (The one caveat about ASC is that its author dislikes the "official" indentation standard, and doesn't follow it. You can use wmlindent through data/tools/GUI.pyw to indent your code automatically. Boy, would he hate to hear me tell you that!)

How much of an abject beginner are you? For instance, do you know a bit of HTML? (That means being able to read HTML source, not write something in a word processor and click "save as HTML".) If so, you should be able to see the parallels in WML with nested tags and key-value pairs. It's just that WML uses brackets instead of braces for tags, and the key-value attributes are between the opening and closing tags instead of within the opening tag.

If not, you might want to look at http://wiki.wesnoth.org/WML_for_Complete_Beginners. It explains the basic concepts of opening and closing tags, keys, values, and attributes. Note that some entries in that guide are more complete than others. One piece of advice I definitely disagree with: it tells Windows users Notepad is "good enough". No it isn't! Get another text editor if you're on Windows. Notepad++ is the most commonly suggested alternative, but there are any number of freeware text editors that can at least claim to be better than Notepad.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)
User avatar
Implementor37
Posts: 121
Joined: February 22nd, 2015, 12:41 am
Location: The Internet

Re: Campaign Creation Team

Post by Implementor37 »

As I suggested before, go to eclipse.wesnoth.org and download the Wesnoth Eclipse Plug-in (You can get a stand-alone version that doesn't require you to install Eclipse). It automatically indents (well, you have to push 'tab' ('\t' character if you know what that is) and it reads files already indented. You may also find some of the other features useful (i.e. green-colored comments, warnings about forgetting to close a tag, Automatic set-up of an add-on campaign directory and _main.cfg, etc.) It is MUCH better than Notepad for learning WML.

*EDIT* I updated the wiki page on WML for Complete Beginners to include a reference to this program. I also made a few edits (mostly link additions) to the pages themselves. I don't currently see a way to find this page from the website unless you already know it exists...Is that intended?
Author of End of the Legion, available now on the 1.12 and 1.13 servers!
Supporter of the addition of the Aragwaithi into mainline.
Post Reply