Why learn WML?

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

lord_midnight
Posts: 23
Joined: April 18th, 2008, 4:35 am

Why learn WML?

Post by lord_midnight »

I know I'm new here, first a disclaimer, I'm only talking in here in the interest of improving my knowledge.

I know little to nothing about Lua, other than it means "moon" in Portuguese, and it is a popular scripting language today.

I know little to nothing about WML, other than it is the official language of Wesnoth. I believe it is an implementation of XML ? Sure looks like it, be nice if it said that somewhere if it is..

I have studied programming theory for several years, I am taking Java in school right now, at my college. I am a first year coder, a first year coder with several years of reading behind him, but very new to actually doing anything with it. I've gotten a 100% on every assignment so far. My instructor says I'm good at it. He is a 30 year mathematician, I respect his opinion and the compliment. So that said, I'm not stupid on this stuff, just new to it.

So, my opinion, as a new developer interested in making things for and within wesnoth, is why am I learning a proprietary language that I can't take really any of the skill or knowledge from to other projects, instead of a robust existing language that is used in many, many places, even sought after in professional work ?

I don't really quite get why you are using a Markup Language, instead of a Scripting Language. It seems counter intuitive to me. I have read most of this thread, I skimmed a couple of pages to get to the recent posts. I just don't get, other than the entanglement in the existing content and code of WML, why you would stay with a proprietary system, instead of using a system that was already there?

I'll learn which ever one I need to to make things for Wesnoth, it just seems foolhardy, to put enough time to learning the language, and not being able to use it elsewhere.

I'm actually interested in the logical reasons behind this, I am trying to start a few games projects myself, questions like this are of inherent value to me.

Um, Dave, or anybody else who can answer, I must know, why not Java ? (other than porting to a new language takes forever)

Thank you guys, I'm very interested in this stuff, even if just from an academic point of view. I'm not trying to dredge anything up, I just like to learn is all, thank you guys for being so patient.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: Why not LUA?

Post by AI »

I'm just going to point out that you seem mistaken as to what 'proprietary' means.
Proprietary means that the language/program/whatever is _owned_ by some entity and imposes restrictions on what you can do with it.
WML is indeed an ad-hoc markup language, (not XML, not even SGML) but it is a free one.
lord_midnight
Posts: 23
Joined: April 18th, 2008, 4:35 am

Re: Why learn WML?

Post by lord_midnight »

I meant proprietary like as in hardware, only works with one thing, not interchangeable. As in, Dell uses proprietary hardware, so you must buy upgrades from them. The opposite of , "industry standard"... sorry if that is confusing, PC tech slang I guess.. lol
MDG
Posts: 378
Joined: June 7th, 2007, 11:18 am
Location: UK

Re: Why learn WML?

Post by MDG »

Consider WML to be something like the data structure of the game and you may gain some insight into it's purpose. What other language gives you "trait" tags, etc...

WML is the game-specific part of the codebase/game engine.

Hope that helps.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Why learn WML?

Post by Dave »

Why a markup language? Because most of what WML does is just data. What units are in your scenario? What are the winning conditions? The losing conditions? Etc etc. All just simple data. No scripting required. Using a scripting language would be over-complicated.

Additionally, learning the basic concept of WML is easy. Very easy. The hard part is learning all the different settings that Wesnoth accepts. If we used a scripting language, you'd still have to learn the Wesnoth API, which would be the hard part to learn (unless you didn't already know the scripting language, in which case errr.....you'd just have a hard time learning how to make Wesnoth content at all).
lord_midnight wrote: I must know, why not Java ?
Why not use Java as a "configuration language" for Wesnoth? :blink: Is that the question or are you asking why the core Wesnoth engine isn't in Java instead of C++?

There are just so many reasons why not to either question, but especially the first one!

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
lord_midnight
Posts: 23
Joined: April 18th, 2008, 4:35 am

Re: Why learn WML?

Post by lord_midnight »

the second one, why c++ over java for the core engine

this was part of the why not lua thread, but got split out.. the thread title is a bit misleading...

I was just interested in why you started with an internal language than a public one, performance control, etc
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Re: Why learn WML?

Post by torangan »

Just consider that we have people playing current Wesnoth versions on Pentium II 300Mhz computers and you know that java is out. Not to forget that java just know is slowly starting to get Free als in FLOSS and at the time Wesnoth started it had a huge way to go still. Of course, personal skills and preferences of the starting developer might perhaps be a factor? A no, that can't be the case, can it? :lol2:
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Why learn WML?

Post by Dave »

lord_midnight wrote:the second one, why c++ over java for the core engine

this was part of the why not lua thread, but got split out.. the thread title is a bit misleading...

I was just interested in why you started with an internal language than a public one, performance control, etc
An internal language than a public one? Huh? C++ is just as 'public' as Java is. This thread just seems really bizarre. You're talking about WML one moment, and then Java and C++ the next and and.....huh? :? I'm afraid I don't really understand what you're asking.

In answer to the one question I do understand: C++ was chosen simply because when Wesnoth began I was the only person developing it and I have broad experience with C++, and so am very skilled in developing programs with it. I have much less experience with Java. Also consider that when Wesnoth was started, in 2003, Java was a much less mature language than it is today.

There are various other issues with Java, that would also likely make me prefer C++ as an implementation language, but they are much too complex to go into here.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
lord_midnight
Posts: 23
Joined: April 18th, 2008, 4:35 am

Re: Why learn WML?

Post by lord_midnight »

sorry for the lack of clarity Dave, I certainly understand your reasons for choosing C++, I would choose the tools I was familiar with myself.. :)

The internal over external comment I made was about WML and Lua, or any other language for that matter. Please let me reiterate, I'm not questioning that you use WML, rather the specific reasons why. As in "I chose to make up my own language because blah blah and yackity smakity reasons." For the most part it has been answered. As a student of game design, I'm interested in these things... knowledge is power right ? If it is so very effective, I may choose to follow the method. Mostly just curious. Again, the title shouldn't be "Why learn WML?" it should be more, "Why was WML chosen over other languages?"

I can understand wanting to make things easy on new developers. My only troubles with the logic is if you are going to have to learn something, why not use something that can be used elsewhere. Also, wouldn't have been faster to have used an existing language, than to have written one from scratch ? Was it hard to create WML, you hand wrote the parser right ? And the definitions, and syntax and... you get the idea, it takes a lot of work to create and implement a computer language. I commend you and the rest of the team, you have done a stellar job !!

Again, this was in the "Why not Lua?" thread first, I'm kinda glad it got split, my question really are beyond Lua itself. Its more about the rational behind the decisions.

The first, and probably most important reason to create a "Mark-Up Language", or "Data-Structure Language", is the total control you got over it. No-one else says how it works or what it can and can't do but you.

The shortcomings I mentioned above, how did you over come them ? What were the biggest obstacles you faced in creating an entire new computer language? If you hadn't made WML, and had used an "off-the-shelf" language for the same purposes, what would have chosen and why ? To rephrase, what was your second choice after WML ?

I know its a lot of questions, I have more. Sorry.

I hope that's a little more clear. It's finals month, I'm pretty sleepdeprived, not to mention the new addition to my family, :)

I am starting to get the hang of WML, I got the Arena working at base, so, I can control what units are available now. Next I think will be the basic map settings. I don't know if I'd be picking this up as fast in another language or slower, though I find WML to be very, very strict, even coming from Java.

Thank you for taking the time to answer my questions,

Sincerely,

Lord Ash Midnight
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re: Why learn WML?

Post by Viliam »

1) During the development of the game, the role of WML changed, and the changes accumulated during years. You are right that if we are making or own language, we can choose what we want... the problem is that at the beginning it was not obvious what will we need later. And later we were under influence of the past.

First it seemed that we will only need some configuration files with lines like "fullscreen=no" and "resolution=640x480". It seemed that something like Windows INI file will be OK. Later some structure was needed to group information, for example each unit would have their own "max_hp", "movement" and "image" keys. It seemed easier to add some small notation, but to keep the most of format backward compatible. Then (I hope I remember the time order correctly) we added localization information, the "_" symbols before some strings; and some simple variables, like "You have $money gold pieces." It worked. Then it got a bit more complicated... and this is where we are now.


2) Many times it was proposed to switch to XML or Lua or Python or something else. The problem is, there was no suggestion yet how exactly to do this. No one was able to propose the exact new system which would do everything that now WML does -- structured data, variables in strings, and string localization. And we do not want to throw away the existing system which works, just for hope that maybe someday someone will be able to suggest a replacement. Replacing WML with something else would be a huge work... and it will not start until someone produces a very clear vision how to do this. (Of course, even such vision may be rejected by developers. But without any vision, WML stays here for sure.)

To get an idea how complicated it is, try to take some mainline campaign scenario, and translate it fully into your favourite language (XML or Lua or whatever). Then look at the result: does it seem easier to read and write? (I tried to do this in XML, but my results were very ugly.)
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: Why learn WML?

Post by AI »

XML isn't even really a language, it's a meta-language.

Anyway, that's how I imagined it evolved, though it looks pretty similar to the current version in 0.4.8 already. (which is as far as the svn will go back)
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Why learn WML?

Post by Dave »

lord_midnight wrote: The internal over external comment I made was about WML and Lua, or any other language for that matter. Please let me reiterate, I'm not questioning that you use WML, rather the specific reasons why. As in "I chose to make up my own language because blah blah and yackity smakity reasons." For the most part it has been answered. As a student of game design, I'm interested in these things... knowledge is power right ? If it is so very effective, I may choose to follow the method. Mostly just curious. Again, the title shouldn't be "Why learn WML?" it should be more, "Why was WML chosen over other languages?"

I can understand wanting to make things easy on new developers. My only troubles with the logic is if you are going to have to learn something, why not use something that can be used elsewhere. Also, wouldn't have been faster to have used an existing language, than to have written one from scratch ? Was it hard to create WML, you hand wrote the parser right ? And the definitions, and syntax and... you get the idea, it takes a lot of work to create and implement a computer language. I commend you and the rest of the team, you have done a stellar job !!
WML was originally, and is still mostly, designed to be a data storage language. It simply stores data describing things in a hierarchical fashion. This makes it in the same class as XML, which is its only likely alternative.

However, understanding WML is trivial. Anyone who knows WML but doesn't know XML could learn XML in under five minutes, and anyone who knows XML but not WML could learn WML in under five minutes.

That part of understanding WML is really really easy. The difficult part is understanding the particular tags and attributes and how Wesnoth's engine works and so on and so forth. That part is never going to be portable no matter what storage format you use.

Now what are the actual reasons I chose to make WML? Honestly a large part of it was simply irritation at how hyped XML was in the software industry at the time, and wanting to avoid it altogether. There are some other reasons though:

- WML is arguably more readable than XML
- WML has a pre-processor which is very useful (arguably one could build a pre-processor on top of XML too, but that would lose many of the advantages of using XML in the first place).
- WML has internationalization support built-in. If we were using XML we'd probably have to do something very ugly to get support for this, which is very nicely done in WML.
- Eliminates a dependency
- XML has a lot of features we don't want or need. Some of these features are somewhat expensive, and so conforming XML parsers are somewhat slow.
- We'd probably have to end up writing our own specialized XML parser, at least for the server, that parses only a subset of XML for efficiency. At that point we're not even really using XML anymore anyway, just our own internally defined subset of XML. I'd rather just use a different language entirely.

Hope that answers your question.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: Why learn WML?

Post by AI »

I never got the XML-hype either: It is a format for writing languages, which is nice in itself, but it's overcomplicated and half of the people running around yelling "use XML!!!" don't even know what that really means.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Why learn WML?

Post by Sapient »

AI wrote:I never got the XML-hype either: It is a format for writing languages, which is nice in itself, but it's overcomplicated and half of the people running around yelling "use XML!!!" don't even know what that really means.
:lol2:

True, true...
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Re: Why learn WML?

Post by Dave »

AI wrote:I never got the XML-hype either: It is a format for writing languages, which is nice in itself, but it's overcomplicated and half of the people running around yelling "use XML!!!" don't even know what that really means.
Oh yes, certainly. If we used "XML" it's much more likely we'd end up using a very simple subset of XML that is fast and contains the features we actually want and need, rather than XML itself.

And even if we did use an available parser, we'd probably end up using a SAX parser and then convert things to our config objects as we go. This wouldn't be that much easier than just writing our WML parser.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Locked