SoC2011 Student Page Aethaeryn

From The Battle for Wesnoth Wiki
Revision as of 04:03, 8 April 2011 by Aethaeryn (talk | contribs) (more introduction)


This page is related to Summer of Code 2011
See the list of Summer of Code 2011 Ideas



This is a Summer of Code 2011 student page
Project: SoC_Ideas_Your_Own_Ideas2011



Description

Michael Babich - Improving Lua Add-ons' Abilities in Interfaces

This main goal of this proposal is to improve the capability of the Lua scripting language when used for creating add-ons, specifically with the various interfaces visible to the users while playing the game. This project will focus on providing simple, but powerful syntax for a broad range of features that enable add-on creators to have improved and easier access to features that mostly already exist within the game engine so that they are free to creatively provide more innovative content. The purpose of this project is to act as a middleman between the game engine and the add-on creators using the Lua scripting language so that simple and powerful add-on creation can help revolutionize future MP, just as [set_menu_item] and [option] allowed for a great evolution in the quality of add-ons since 1.3. This interface framework needs to be as broad as possible in the time given and the scope allowed so that creative add-on authors themselves can stretch Wesnoth content far beyond its traditional style, but it also must provide a simplified Lua helper library so that everyone can use it without necessarily having to delve deeply into the complexity that exists in the currently-existing GUI.

The Necessity of Improvements to Simplify and Extend Lua's Add-on Capabilities

I have been making content for Wesnoth since 2007 and I have been gradually porting much of my more advanced content to Lua since late 2009. While doing so, I have noticed certain limitations to the current implementation of Lua as it relates to add-on creation, especially with certain elements only possible through WML or the rather poorly readable WML tables. As the title suggests, I wish to simply and extend the add-on creation capabilities in Lua. In particular, I will be working with various elements of the interface code because this is currently where Lua is weak and often just relying on WML tables. There are several problems with using WML tables in these areas:

  • Poor readability, clumsy syntax, and verbosity. The metatable in the helper library helps with readability, but does not always work (for instance on [or] and [and] boxes, where those words are reserved in Lua) and it still hides the underlying issue that true native Lua support is not there. It also is fairly difficult in certain applications where the XML-style WML syntax is clearly inferior and much more verbose than something done in pure Lua.
  • You're essentially using WML. This defeats the purpose of using Lua in the first place if the majority of your code in a particular area is in WML. This is made even more severe when one realizes that many of the areas that must currently be done via WML tables are complex things that are the kind of things best done in a real language in the first place. In particular, the [message], [option], and [set_menu_item] have no real Lua equivalent.
  • Calling Lua from WML tables is hacky. Currently, if one wants to call a Lua function from T.option {}, one has to set a string that is a call on a global Lua function.

Fortunately, there solution is rather obvious. Lua needs to be extended to access features that almost all already exist in the game engine and these must be implemented through Lua functions and tables instead of WML tables so that the full benefits of using Lua for scripting can be realized. Although the problem and solution are fairly easy to describe, certain precautions must be taken to make ensure that save games are not broken and no new issues are introduced. In addition, the individual proposed changes must be enumerated for clarity as to the scope of the project.

Goals

The Implementation: Overview

The information can roughly be broken down into three separate phases, 0 through 2. First, I shall go through an overview so as to be straightforward with the overall planned changes, then I shall provide the details of each individual section, and finally I shall propose a detailed timeline as to when each part can be accomplished.

Phase 0: The Initial Changes

  • Split src/scripting/lua.cpp into logical subcomponents and familiarize myself with the core Lua code.
  • Implement UI tags in native Lua without WML tables. (similar to fire or the improved 1.9 version of it, setting first time only to yes)
    • [message]
      • [option]
      • [text_input]
    • [set_menu_item]
  • Create a mechanism by which to allow an execution of Lua through [option] that is save-game compatable.

Phase 1: Complex Interface Changes

  • Implement improved Lua access to the in-scenario GUI stuff, again without WML table hacks.
    • This includes improving the syntax and implementation of the dialog Lua.
  • A way to take in text commands in a way similar to debug mode's :lua, but only using specific commands to do specific actions as defined by Lua code in the add-on.

Phase 2: Simplify Add-on Creation

  • Implement Lua "ui" package similar to helper that adds an additional abstraction layer on top of Phase 1 to simplify it for add-on creators.
  • Create a similar implementation to the above through newly-defined WML tags.
  • (The original implemenation will still exist for those who want more control and customizability, while this implementation is available for those who do not wish to deal with the complexity that the interface can actually provide.)

The Implementation: Details

The Implementation: Timeline

Questionnaire

Basics

1.1) Write a small introduction to yourself. I am Michael Babich, better known to the Wesnoth community as "Aethaeryn". I'm 20 and I'm from Baltimore, Maryland, USA. I'm currently in my third of five years at UMBC. I've been using Linux as my primary operating system since 2005 and I've been involved in the Wesnoth community since 2007. I'm a very big proponent of Linux and open source software, which is why I am currently an officer in my university's Linux Users' Group.

1.2) State your preferred email address. I am paranoid about spambots, and I know they're out there patrolling this wiki since I've dealt with the majority of them this year. Is it possible to only put this in the Google application?

1.3) If you have chosen a nick for IRC and Wesnoth forums, what is it? Aethaeryn

1.4) Why do you want to participate in summer of code? I love Google. You can tell I'm a bit of a fanboy because I'm one of the (apparently) few people who actually bought an unlocked, full-price Nexus One when it was being sold through Google. I love summer because it allows me to work on projects that I might not have time for at other parts of the year.

I love coding, especially for Wesnoth, where I have five in-progress add-ons (they'll be ready when they're ready), one published add-on, and several obsolete add-ons on older versions of Wesnoth (trust me, they weren't that great). I'm also a college student, which means that I don't have much money, and getting paid to sit at my computer and do the kind of stuff I would do anyway rather than having to get a job unrelated to what I do for fun is a perfect opportunity.

Of course, even though I'd hypothetically do it anyway without GSOC, I probably wouldn't be able to follow through on any significantly large mainline project without the GSOC incentive because (1) it would go on my resumé as an internship so I'd have added motivation to push through even the most difficult parts and (2) I wouldn't have to get a day job so I would actually have time to code, which is an important thing too.

1.5) What are you studying, subject, level and school? I go to University of Maryland Baltimore County (UMBC), a university that happens to be located in Baltimore County, Maryland.

I am an undergraduate in my third year out of five, studying Computer Science, Mathematics, and Philosophy. As of the end of this semester, I have met all of my requirements in Philosophy. For Computer Science and Mathematics, I'm about 1/3 to 1/2 of the way through those programs. While I'm certainly majoring in Computer Science and Philosophy, I might minor in Mathematics instead of majoring in it. I'll have to see how the upper level courses are.

My GPA is currently 3.713, but it's currently 4.0 in computer science, mathematics, and logic-related philosophy.

1.6) What country are you from, at what time are you most likely to be able to join IRC? I'm from the United States, on the east coast, and I'm almost always on IRC when I'm not at classes. During the summer, I should be on IRC all-day Friday, all-day Saturday, all-day Sunday, and evenings (probably 4pm or 5pm EDT to midnight or later) the rest of the days. I may also be able to be online at other times, such as the mornings. If necessary, I can even host my "screen irssi" on a remote server and simply ssh into it, which would enable me to be "on" IRC even when I'm not on my computer.

1.7) Do you have other commitments for the summer period ? Do you plan to take any vacations ? If yes, when. Because of my overly-ambitious academic goals, there's no way to get around taking summer classes, but I'm only going to be taking two (last summer I took four). I have a Monday/Wednesday/Thursday math class from 9:00 AM to 11:05 AM (eastern US time), May 31st to July 8th. I have a Monday/Tuesday/Thursday math class from 1:00 PM to 3:05 PM, May 31st to July 22nd. Other than that, I have no social life outside of school (and it's summer break) and IRC (all except two on my default join list are Wesnoth-related channels). I never go on any vacations because I'm not rich and my family's not rich.

Experience

My primary strength in terms of experience is that I've been with the Wesnoth project, doing almost everything possible except developing for the game engine itself over the course of almost four years. I know the Lua because I've made add-ons in Lua and will continue to port my active add-ons to Lua as time goes on. I know the community because I am part of it. I know the IRC channels because I've regularly been in many of the channels for years. I'm familiar with a lot of things over the years that might take other people a while to pick up. I've even been using SVN as my means of downloading/updating/playing Wesnoth for at least two years now (for stable, development, and trunk).

2.1) What programs/software have you worked on before? I have worked on coding projects for school (nothing truly substantial since the time-span to work on them is relatively short), and I have some local things that I have never published. In terms of code that's actually out there on the Internet, published, I have numerous Wesnoth add-ons. These are the ones that are accessible in some way (much of my earlier, unfinished work before wesnoth-umc-dev is currently inaccessible and not that demonstrative of skill, anyway):

I have collaborated with others on Thunderstone Era/Trilogy and Wesalwyn. I also collaborated on story/dialog parts of Underlands RPG. Some of my earlier works, including some of Era of Tyrants and the oldest scenarios in Aethaeryn's Maps, reused with permission certain code from other GPL'd sources, but MoD is from-scratch, especially since I rewrote most of it in Lua earlier this year. Most of my work here is mostly individual, though. The most substantial and recent example of my coding in Wesnoth add-ons, in Lua, is Master of Dungeons.

In general, I have preferred writing Wesnoth MP add-ons instead of my own full games from scratch (at least, in things that I've managed to finish).

2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own) I have utilized the Wesnoth-umc-dev SVN repository for my add-ons for two years, and have collaborated with several other users of that repository for a few add-ons, especially Thunderstone Era. Most of my work, especially the unpublished stuff, has been individual, though.

2.3) Have you participated to the Google Summer of Code before? As a mentor or a student? In what project? Were you successful? If not, why? I have not participated in GSOC before, but I have as part of the Wesnoth community observed GSOC as an outsider. I've always wanted to do a GSOC when I gained enough formal (university) and informal experience with programming and I believe that I am finally ready.

2.4) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement. I have been involved in the Wesnoth community since 2007:

  • add-ons (since 2007; published since 1.3.x)
  • Lua-based add-ons (since 2010)
  • wesnoth-umc-dev SVN repository (since 2009)
  • unofficial Wesnoth-style sprite art (since 2008)
  • Latin translator (since 2009)
  • wiki moderator (since 2009)

Usually I'm more active in the Wesnoth project during vacations and weekends due to university work taking up a lot of time during the school year.

2.5) Gaming experience - Are you a gamer?

2.5.1) What type of gamer are you? Mostly a strategic thinker, preferring to play slowly so I can formulate detailed plans.

2.5.2) What type of games? I love strategy games. I used to be big on RTS games, but ever since I found Wesnoth, the "strategy" part in RTS games seems more and more like a joke because turn based strategy games are far superior in terms of actually giving one enough time to formulate a strategy. I've played various mainstream/commercial games, such as RTSes, FPSes, and action games, but the only OS I have been using for the past few years is Fedora Linux and I've been focusing on my academics and on programming, so I haven't really kept up to date on the latest games out there. In addition, Wesnoth has shown me that making games can be more fun than playing games (and playing things one makes is the best of both worlds).

2.5.3) What type of opponents do you prefer? I prefer cooperating as part of a team, even if there are no opponents at all. When I play against an opponent, I'd like to play against someone who's playing for fun and isn't too serious about the outcome of the game. I prefer team-oriented matches in Wesnoth because they are, in general, less competitive and more social. My second favorite type of Wesnoth game is a free-for-all because they're so chaotic that, again, it's more about having fun and socializing than competing. I can easily get too competitive in a game to the point where it loses any fun if I take it too seriously, so I avoid things like the ladder and I tend not to play 1v1s at all.

2.5.4) Are you more interested in story or gameplay? If the gameplay sucks, the story won't redeem it, but if the story sucks, the game can get boring after a while and doesn't feel truly immersive. As for which I prefer, I can't say I really prefer one over the other. I was a writer long before I was a programmer and for some things, I work extensively on the backstory before I even write a line of code, while for other things I definitely have the gameplay in mind first and then come up with a story once there's something fun and playable.

2.5.5) Have you played Wesnoth? If so, tell us roughly for how long and whether you lean towards single player or multiplayer. Almost four years experience, mostly MP but also a significant amount of SP when I first started playing Wesnoth. I've been playing since the 1.2/1.3 versions.

2.6) If you have contributed any patches to Wesnoth, please list them below. You can also list patches that have been submitted but not committed yet and patches that have not been specifically written for GSoC. If you have gained commit access to our SVN (during the evaluation period or earlier) please state so. I'll have to come back to this after I submit the proposal to Google's website.

Communication skills

3.1) Though most of our developers are not native English speakers, English is the project's working language. Describe your fluency level in written English. English is my native language.

3.2) What spoken languages are you fluent in? I'm fluent in English. I'm also fairly proficient in Latin, and am a Latin translator for Wesnoth, but, unfortunately, that's not much of a spoken language these days.

3.3) Are you good at interacting with other players? Our developer community is friendly, but the player community can be a bit rough. Yes. Because I have been with the Wesnoth community for years, I am aware of certain aspects of the community that have in the past unintentionally driven certain talented people away. As long as I don't do anything related to the RNG or mainline art, I hope I'll be okay. ;-)

3.4) Do you give constructive advice? Yes.

3.5) Do you receive advice well? Yes.

3.6) Are you good at sorting useful criticisms from useless ones? Yes.

3.7) How autonomous are you when developing? Would you rather discuss intensively changes and not start coding until you know what you want to do or would you rather code a proof of concept to "see how it turn out", taking the risk of having it thrown away if it doesn't match what the project want? I have no problem with coding many, many hours on my own once I know what I'm supposed to be coding, but I definitely don't want to waste hours working on something that's just going to be thrown out, so I definitely will seek feedback as much as necessary in order to not waste any time/effort.

Project

4.1) Did you select a project from our list? If that is the case, what project did you select? What do you want to especially concentrate on? I did not select a project from the list.

4.2) If you have invented your own project, please describe the project and the scope.


4.3) Why did you choose this project? As a long-time add-on creator for Wesnoth, I am aware of certain limitations currently present when one is creating add-ons. Because I have started to port my add-ons into Lua, I have noticed that there are some features that have to be done through hackish WML Tables (essentially coding WML through Lua) because of what appears to be a currently incomplete implementation of Lua. I have noticed that most of these issues seem to be related to various parts of the interface and so that is where I have chosen to focus my efforts, after consulting Crab_ and others on IRC. My eventual, long-term goal is to make Lua powerful enough to handle most of the event-driven scripting side of Wesnoth content while leaving WML to do what it does best, mainly the basic definitional things.

An ideal scenario or campaign would be one that uses WML to define the basic structure and then call on Lua for any more advanced elements. As I spend most of my Wesnoth time making -- or playing -- content for MP that do things that WML was not originally intended to do, such as making Wesnoth an RPG instead of a TBS, I have noticed that WML does not scale very well as a general purpose language doing advanced scripting. Any traditional language, such as Lua, can handle certain advanced things in a much more readable and efficient manner, but there are certain gaps in Lua where WML tables must be integrated with the Lua, which defeats many of the primary reasons to use Lua in the first place.

4.4) Include an estimated timeline for your work on the project. Don't forget to mention special things like "I booked holidays between A and B" and "I got an exam at ABC and won't be doing much then".

4.5) Include as much technical detail about your implementation as you can

4.6) What do you expect to gain from this project?

4.7) What would make you stay in the Wesnoth community after the conclusion of SOC? I've been with the Wesnoth community since 2007. I'm staying.

Practical considerations

5.1) Are you familiar with any of the following tools or languages?

  • Subversion (used for all commits)
    • Yes.
  • C++ (language used for all the normal source code)
    • Yes.
  • STL, Boost, Sdl (C++ libraries used by Wesnoth)
    • No.
  • Python (optional, mainly used for tools)
    • Yes.
  • build environments (eg cmake/autotools/scons)
    • Yes.
  • WML (the wesnoth specific scenario language)
    • Yes.
  • Lua (used in combination with WML to create scenarios)
    • Yes.

5.2) Which tools do you normally use for development? Why do you use them? I use GNU emacs, which I supplement with traditional UNIX tools, such as grep and gdb, as well as various scripts, mostly in Python. I've been using Linux as my primary (and often, including now, my only) operating system since 2005 so I have familiarity with the Linux way of doing things. I believe things like this are a matter of taste as long as one has experience with the tools one uses and the tools are appropriate for the task. One of the great things about Linux, and FOSS software in general, is that there's typically at least two good options for any given need, so I really don't want to start an editor war by saying that emacs is clearly superior to something else.

5.3) What programming languages are you fluent in? In order of experience and confidence in the language: Python, Lua, Java, WML, C++, sh, Lisp.

5.4) Would you mind talking with your mentor on telephone / internet phone? We would like to have a backup way for communications for the case that somehow emails and IRC do fail. If you are willing to do so, please do list a phone number (including international code) so that we are able to contact you. You should probably *only* add this number in the application for you submit to google since the info in the wiki is available in public. We will *not* make any use of your number unless some case of "there is no way to contact you" does arise! Yes, but I'm only adding it in the application.