Difference between revisions of "SoC2011 Student Page Aethaeryn"

From The Battle for Wesnoth Wiki
m (add IRC nickname)
m (what the hell was I thinking when I wrote such a long title? changed to "introduction")
Line 10: Line 10:
 
Aethaeryn
 
Aethaeryn
  
==The Necessity of Improvements to Simplify and Extend Lua's Add-on Capabilities==
+
==Introduction==
 
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:
 
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.
 
* '''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.

Revision as of 15:26, 8 April 2011


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's User Interface Capabilities

I intend to improve the ability for add-ons to customize the user interface through Lua. I will focus on providing simple, but powerful syntax for a set of functions that will enable add-on creators to have improved, easier access to features that 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.

IRC

Aethaeryn

Introduction

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.

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.

Fortunately, the solution is rather obvious to the WML table problem. 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.

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

First, src/scripting/lua.cpp should be split into smaller, logically-organized files so that the file does not grow too large and unmanageable with the improvements planned. This has the additional effect of allowing me to get familiar with the core Lua code.

Next, various UI tags shall be implemented in native Lua without WML tables. The hardest portion of this is ensuring that the Lua changes can be implemented without breaking save files. Most of the existing WML code can be reused, so a key purpose of this is to get rid of the need for WML tables for this portion of the code so that it better interacts with files written purely in Lua and so it is in a consistent style with code in the later portion of this project. The tags that need to be ported to Lua functions:

  • [message]
    • [option]
    • [text_input]
  • [set_menu_item]

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

I'm sleeping. This section will be filled out when I can think again.

Phase 0

gui_message()

option

text_input

set_menu_item()

Calling on Lua Code From a Message

Phase 1

Dialog Improvements

GUI 2 Access

Commands?

Phase 2

wesnoth.ui

WML additions

The Implementation: Timeline

now April 08 - April 22   Discuss details of the implementation with the various developers so that the proposal is ready for the summer. Work on basic patches, especially in the early areas of Phase 0, so that commit access can be granted before the designated GSOC period. Most of the design needs to be finalized in this period.
April 23 - May 08 Continue to familiarize myself with the project and its code by doing more of Phase 0.
May 09 - May 18 Spring semester ends. Availability may be limited during this period. (The days might be slightly off depending on what the final exam schedule is.)
May 19 - May 30 My schedule should be entirely free in this time span, so Phase 0 should be completed (if it isn't already finished) and substantial progress should be made on Phase 1.
May 31 - June 30 The entire month of June will be spent on Phase 1.
July 4 - July 8 Expected busy week as my one summer course wraps up.
July 9 - July 17 Phase 1, the bulk of the project, should be concluding around this point. Since this is around the middle evaluation point, part of the focus should be on reviewing the design and plans for the second half of GSOC. If I am ahead of schedule or behind schedule, adjustments can be made.
July 18 - July 22 Expected busy week as my other summer course wraps up.
July 23 - August 15  Phase 2. Again, my schedule should be entirely free to focus on the project.
August 15 According to Google: "'pencils down' date. Take a week to scrub code, write tests, improve documentation, etc."
lim t
t→∞
Continue to work on Wesnoth's Lua scripting capabilities because it certainly will take more than just one summer to perfect it.

Goals

Patches

Work on the Phase 0 patches will resume immediately after this document is finished and submitted.

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 love 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.

[spambot paranoia]

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 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, the old stuff wasn't that great). Even though I'd hypothetically try to contribute the code related to these patches without GSOC paying me, I probably wouldn't be able to follow through on any significantly large mainline project without the GSOC incentive. It would count as an internship so I'd have added motivation to push through even the most difficult parts and I wouldn't have to get a day job so I would actually have time to code, which is very important. Often, I have lots of things I would code given the time, but I simply don't have the time to accomplish everything I would like to accomplish. GSOC is essentially an excuse to do what I want to do and have it be my top priority at the same time.

1.5) What are you studying, subject, level and school?

I go to University of Maryland Baltimore County (UMBC). 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 in class. During much of 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. For other parts of the summer I'll literally be on 24/7 except when RL interferes. See (1.7) and the timeline for when I have other commitments.

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 not take summer classes if I ever intend on graduating, 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. So yes, those time slots are literally my only other time commitments for the entirety of summer. For much of May and all of August, I will be doing nothing of importance at all and probably would be spending it on Wesnoth anyway.

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'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. In general I have preferred writing Wesnoth MP add-ons instead of my own games from scratch. These are the add-ons that are accessible in some way (not an exhaustive list):

Also see my user page. The most substantial and recent example of my coding in Wesnoth add-ons, in Lua, is Master of Dungeons.

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. 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 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.

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)
  • unofficial Wesnoth-style sprite art (since 2008)
  • wesnoth-umc-dev SVN repository (since 2009)
  • wiki moderator (since 2009)
  • Latin translator (since 2009)
  • Lua-based add-ons (since 2010)

2.5) Gaming experience - Are you a gamer?

Yes.

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 have in the past played various mainstream/commercial games, such as RTSes, FPSes, and action games. However, the only OS I have been using for the past few years is Fedora Linux. I've also been focusing on my academics and on gaining programming experience, 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 my own games 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, especially 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 will not be able to submit a patch by the application deadline, but they will be here when I have the time.

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, although I do not believe that I would be able to evaluate myself in an unbiased manner on such an issue. I can only assume that I give good enough advice because people ask me for advice (more than once, of course). I suppose if you were really skeptical Espreon would vouch for me here. I hope.

3.5) Do you receive advice well?

Yes. I'm a student, so I see myself as a constant learner. If I already knew everything, I wouldn't be applying for GSOC.

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

Yes. The Internet these days is all about separating useful from useless content so it's a valuable skill to develop. I'd have no time at all if I was bogged down reading everything out there.

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.

See here.

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 and inelegant 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. So, yes, this project is one I invented, but I wouldn't say that I invented it on my own because I did ask for advice on IRC in narrowing my topic from the very broad scope of "Lua" to something more specific.

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".

See here for the timeline.

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

See here.

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

  • Experience working with a large project with many developers and a mature code-base. The project is massive compared to anything done in university work, so it will provide practical programming and software engineering experience that will make the programming projects for classes seem extremely trivial.
  • Experience with open source. While Linux and FOSS have been passions of mine for more than five years, I need tangible, quantifiable experience that can demonstrate my commitment to FOSS values and GSOC presents the perfect opportunity to do so. Although I have been involved with the Wesnoth community since 2007, I have never actually gotten involved with the mainline code and do not have commit access, so this will provide a unique perspective I have not yet seen to the Wesnoth project, and FOSS communities in general.
  • Improving what I can do with Lua as an add-on creator. I would be lying if I didn't mention the suspicious correlation between me wanting to improve Lua's capabilities as an add-on scripting language and me having a substantial amount of add-ons either in Lua or about to be rewritten into Lua. Actually improving what I can do in add-ons using Lua might be the primary thing I expect to gain from this GSOC. >:D

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, I've used it for both wesnoth (updates only) and wesnoth-umc-dev (updates and commits) for several years.
  • 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. Python is a great language for scripting stuff.
  • build environments (eg cmake/autotools/scons)
    • Yes, primarily scons. Did I mention that Python is great?
  • WML (the wesnoth specific scenario language)
    • Yes, I've written Wesnoth add-ons since '07.
  • Lua (used in combination with WML to create scenarios)
    • Yes, I've been writing Wesnoth-related Lua since late '09.

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 that choices like these are a matter of taste as long as one has experience with the tools... and as long as those tools are appropriate for the task, of course! 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/confidence: 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!

[spambot paranoia]