SummerofCode Timotei21

From The Battle for Wesnoth Wiki
Revision as of 13:18, 10 July 2010 by Timotei21 (talk | contribs) (wml syntax highlighting in progress)


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



This is a Summer of Code 2010 student page
Project: SoC Ideas Eclipse Plugin


Contents

Description

Timotei21 - Eclipse UMC Plugin

gna.org: timotei
irc: timotei21/timotei
forum: timotei21

I'm Timotei, and I want to participate in GSOC, as a developer at Battle for Wesnoth game. I'm interested in developing the Eclipse UMC plugin. For details of implementation and planning, see the Proposal Summary and the Timeline.

Last Updated: 16th of April 2010

IRC

timotei, timotei21

SoC Application

Battle for Wesnoth - Google Summer of Code Application

Proposal Summary

The plugin will be an Eclipse Plugin. The features needed are listed here: http://wiki.wesnoth.org/SoC_Ideas_Eclipse_Plugin

Editor:

The editor will be made using the 3rd party library: "XText"(http://www.eclipse.org/Xtext/) - thanks Crab_. That is a library for implementing in an easy way a DSL editor with auto complete, syntax highlighting, etc.

The plugin will consist of 4 projects:
- eclipse plugin
- eclipse plugin.tests
- xtext.ide
- xtext.generator
- xtext.ui

Schema

The WML files apply to a specified schema (data/schema.cfg): it has to be converted into a .xtext format and be put in the "Wml.xtext" file, which will compile the xtext editor. So, each time when we start the plugin, and detect a change in the "schema.cfg file (we could check that against a hash code/md5 of the file), we need to "re-generate" our "editor". That will be made in a background thread (using Workspace Jobs "Workspace Jobs") or when the users wants this (no automatic generation) - via project's context menu (using popupMenus extension), this will toggle the nature on/off.

Code checking/validating

The code check will be made using IncrementalProjectBuilder that will check the project after each file(s) save, with "wmllint" and "wmlscope". Also it will add the corresponding (problem/warning/other) markers on the file(s) that need to be revised by the user. The ProjectBuilder will have associated a Nature extension that will hook the builder with current project.

Debugging capabilities

Having a chat with fendrin/fabi we've decided to add some new ideas:
- There will be a way the game could communicate with the editor, sending him the wml errors, the stack trace and the wml variables environment, facilitating debugging the .cfg files. (Crab_ suggested I shouldn't dive in this, but I will give some of my ideas on how to implement it)

  • Idea1: the game would run a "local server" on a specified socket, and establish a connection to the plugin, to whom will send messages or receive messages regarding the debugging instructions.
  • Idea2: the game would output in the console specific plugin messages with instructions. but this way the game wouldn't be aware of plugin's instructions since there isn't a two-way connection.

- There will be a wml tag [breakpoint] that will work like a breakpoint, signal the editor and return him the wml variables environment or other debugging information (we could add an option to the [breakpoint] tag whether or not to display the variables environment). That way we can actually "debug" the wml code we write.

Macro handling

This is an interesting problem to solve. My idea is to use a macros hashtable based on the read files. This will provide a fast way to search for existing macros if there are many. The value of the specified key will contain a MACRO_DETAILS structure

MacrosHashtable: key - macro name | value - MACRO_DETAILS instance

A MACRO_DETAILS is basically a list. It contains various implementation of the same macro name. Each element in the list is a MACRO_IMPLEMENTATION structure, with the following members:
- Macro name
- Macro implementation(s) (normal implementation, expanded implementation - the macros in it are recursively expanded. The expanding will be made AFTER we complete all macro hashtables, and until that I will mark as "dirty" the macros that need to be expanded, so we can get back and expand them.)
- A hashtable with files where the macro is visible/defined - the key, and the lines between it is visible - the value. Why hastable? Because we can search if the macro is defined for a specified file, in O(1) time which is very good, if we have to check for multiple files.

Let's see an example.

_main.cfg:

1	#define M_UTIL
2		... macro_def_util ...
3	#enddef
4	#define M1
5		... macro_def1 ...
6	#enddef
7	{myscenariosdir}

myscenariosdir/f1.cfg

1	.. some code ..
2
3	{M1}
4	

myscenariosdir/f2.cfg

1	.. some code ..
2	#comments
3	#undef M1
4
5	.. some code ..

myscenariosdir/f3.cfg

1	#header comments
2	#define M1
3		... {M_UTIL} ...
4	#enddef
5
6

MacrosHashtable:

"M1"
{
	name="M1"
	implementation1 
	{ 
		normal = "macro_def1"
		expanded = nil
		visible_table = {"_main.cfg"=>"4-7", "myscenarios/f1.cfg"=>"1-4", "myscenarios/f2.cfg"=>"1-2"}
	}		
	implementation2
	{
		normal = "{M_UTIL}"
		expanded = "macro_def_util"
		visible_table = {"myscenarios/f3.cfg"=>"2-6"}
	}
}
"M_UTIL"
{
	name="M_UTIL"
	implementation1 
	{ 
		normal = "macro_def_util"
		expanded = nil
		visible_table = {"_main.cfg"=>"1-4", "myscenarios/f1.cfg"=>"1-4", "myscenarios/f2.cfg"=>"1-5", "myscenarios/f3.cfg"=>"1-6"}
	}		
}

The plugin will have always in memory the current opened files, expanded. So, if we have the following file:

Macro definition:

#define ABILITY_EXTRA_HEAL
    [heals]
        value=8
        id=healing
        affect_allies=yes
    [/heals]
#enddef
#define ABILITY_UNPOISON
    [heals]
        affect_allies=yes
        id=curing
        name= _ "cures"
    [/heals]
#enddef
#define ABILITY_CURES
    # Canned definition of the cure ability (which entails heal+8) to be
    # included in an [abilities] clause..
    {ABILITY_UNPOISON}
    {ABILITY_EXTRA_HEAL}
#enddef

Usage:

1	[scenario]
2		name= _ "The Uprooting"
3		id=01_The_Uprooting
4		next_scenario=02_Hostile_mountains
5		# comment
6		{ABILITY_CURES}
7	[/scenario]

1st Expansion, and when exapnding the macro we will hold for the expansion the same line it was on first time:

1	[scenario]
2		name= _ "The Uprooting"
3		id=01_The_Uprooting
4		next_scenario=02_Hostile_mountains
5		# comment
6		{ABILITY_UNPOISON}
6		{ABILITY_EXTRA_HEAL}
7	[/scenario]

2nd Expansion:

1	[scenario]
2		name= _ "The Uprooting"
3		id=01_The_Uprooting
4		next_scenario=02_Hostile_mountains
5		# comment
6		[heals]
6			affect_allies=yes
6			id=curing
6			name= _ "cures"
6		[/heals]
6		[heals]
6			value=8
6			id=healing
6			affect_allies=yes
6		[/heals]
7	[/scenario]

So, we check this with our tools, and when reporting, it will point to the original 6th line, where the macro is.

Misc

Since automcompletition will complete for next_scenario,maps,etc; the user will choose sometimes to add a new non-existing scenario/map. When he presses F3 to go to the declaration, if the artifact doesn't exist, he can choose to create it, so it will be presented a wizard for creating the required file. In the case of a map the map editor will open up.

UMC Projects

Each umc project will have the following options (that will be memorized in the .project file or using IMememto):
- apply wmlindent on file(s) save : YES/NO
- autorepair code with wmllint: YES/NO
- path to the game folder (for launching the map editor/game, searching for Macros, data/schema.cfg)
- arguments for launching the map editor/game

For the background checker feature, we will use MarkerResolution extension to provide information regarding fixing the error (for example, when an attribute has incorrect type, we can get the correct type from the schema file)

Wizards (newWizards extension):

The wizards that create the projects will have some default values for specifig tags/attributes, based on the schema file and attribute type. There will be also the possibility to import the existing projects (But here we need to agree on a specific format with other developers and WML coders).

We will have "Project Wizards" for:

   - Campaigns
   - Eras
   - Multiplayer Campaigns/Scenarios

We will have "File Wizards" for:

   - Factions
   - Scenarios
   - Units

Deploying and distributing the plugin

There are 2 way for distributing the plugin:
1) Host it on a server, using the "Update Project Site" project (we need to add first a new feature of then plugin so we can import it into the site) from eclipse. This way we can install the plugin via "Install Software" menu from inside eclipse - no "dirty" hacks needed.
2) Upload the plugin on the server, and let the users copy-paste it into eclipse's plugin folder. We could make a simple java installer for this, based on the current eclipse's install path and current operating system.

WML Re-deployment/ WML Jit(Just-in-time)

//todo: study more and come up with an idea

Redesign the way wesnoth starts

Command line arguments for:
- start test campaign/scenario: Command: -c[[<difficulty>] <id_campaign> [<id_scenario>]] , --campaign[[<difficulty>] <id_campaign> [<id_scenario>]]

There is an implementation patch submitted for this: https://gna.org/patch/index.php?1625

Unit testing

Since every quality software needs to be tested, I will create some unit tests for the eclipse plugin. This units will check if the new modifications, break or not the previous functionality and also verifies that the user is able to do specific things. So here is a small (pending) list of tests that will exist. They will be a separate project and the tests will use JUnit.

User workflow tests:
- Creating a campaign - check for file+folder structure
- Creating a scenario - check for file structure
- Creating a non-existing map/scenario - check if file created
- Accessing the plugin context menus - check if correct actions executed

Functionality tests:
- Use a non-existent Macro - check is error spawned
- Use incorrect defined wml file - check if error spawned
-

Other resources:

- WML Schema: data/schema.cfg
- macros: data/core/macros/*.cfg

Timeline

The GSOC period is between 24th May and 20th August. But since I have exams for about 3 weeks (during 31.05-20.06.2010), I will start working on the plugin before the 24th of May. Also the unit tests will be made through the gsoc period - no fixed time for them.

Pre-GSOC period:
- get familiar with WML
- get familiar with WML* tools (validator, scope, lint, indent)
- recover the work that has to be done between the exams period
- study the features that XText offers

90rdi9.png
(Note: Green items have been completed) (Note: Yellow items are in progress)

Part I
  • Approximate due date: 27-30 May
  • Deliverables:
    • Plain text editor preview
      A simple text editor, with simple WML features (like markers read from a dummy program), just to be there and working, so I can build on top of it the remaining features
    • Some wizards that create the directory + file structure and add some basic tags, based on the wizard type
    • Menu for starting the existing tools like map editor, server.
  • Needed resources/talking with devs: Full list of "UMC Artifacts"; research about existings 3rd party libs that can be used in developing the eclipse plugin.

Pause development phase: 31.05-20.06.2010 - exams

Part II
  • Approximate due date: 1-5 July
  • Deliverables:
    • WML syntax highlighting
      Highlighting start/end tags.
    • Frontend for common wesnoth helper tools like wmllint and wmlindent + background checker
    • Actual implementation of the wizards
  • Needed resources/talking with devs: The template used for highlighting (get that from eclipse/integrate with eclipse fonts and colors?)
Part III
  • Approximate due date: 15-20 July
  • Deliverables:
    • Upload UMC to wesnoth addon server
    • Start the map editor with the current/selected map
    • Start the game using the temporary created content
    • Polishing the plugin - graphics+icons, structure the menus
  • Needed resources/talking with devs: Server location; Integration with the website?
    The way we start the game with current map/scenario/campaign - are there any existing command line arguments?
Part IV
  • Approximate due date: 1-5 August
  • Deliverables:
    • Autocompletition
    • Macros (like in Visual Studio/Eclipse: double tab to insert it?)
    • F3 navigation for: Maps, Macro Definition
    • Floating box when hovering over macros - show implementation
  • Needed resources/talking with devs:The common WML format used for importing and for knowing what wml file type is, so we can provide better assistance for helper/completition.
Part V

Questionnaire

1) Basics

1.1) Write a small introduction to yourself.

My name is Timotei Dolean, 20 years old and I'm from Cluj-Napoca, Romania. I'm one of the best students in my year, and I have reached the time when I should start working on open-source projects or team-based projects, like the ones in GSoC. I'm also very passionate about programming, doing it my spare time and also having fun with other people/my friends.

1.2) State your preferred email address.

timotei_cluj [at] yahoo.co.uk

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

timotei21

1.4) Why do you want to participate in summer of code?

I have some friends that participated at GSoC the last few years, and they gathered a lot of new friends and achieved a lot of experience in OSS / Team programming. Also, about 2-3 years ago I was looking over some open source projects, related to a Lineage 2 MMORPG server, made in java, but didn't have enough time and experience to be part of the community. So now, based on my spare time and experience, I decided to take part in Battle of Wesnoth project, during the GSOC, and so I will fulfill my dream.

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

I'm currently 1st year undergraduate at the Technical University of Cluj-Napoca, Computer Science.

1.6) What country are you from, at what time are you most likely to be able to join IRC?

I'm from Romania, Eastern Europe (Timezone: UTC +2). Usually I'm available for about 2-8 hours a day, but in the day-time - I better sleep in the night, so I can start earlier the next day. So basically I will be available: Mon-Wed: 14.00 - 22.00 UTC+2; Fri-Sun: 8.00 - 22.00 UTC+2;

1.7) Do you have other commitments for the summer period? Do you plan to take any vacations? If yes, when.

Like every student, I'll have exams in the following period: 31.05-20.06.2010, that's 3 weeks. So in that period the time for development will be very few/none.

2) Experience

2.1) What programs/software have you worked on before?

  • InfoCenter - application for aiding high-school students in learning the C++ language. This is the biggest project I have ever worked on. (technologies and tools used in development: Visual Studio, C#, SVN, XML, MS Access Database, ReSharper)
  • Lineage 2 Launcher & Server – application for launching and updating the “Lineage 2” game from a web server, registration on the server for new users. The game was used to connect to my custom “Lineage 2 MMORPG” server (the server was developed in java by an existing open-source community - l2jserver). I modified the server adding new features, fixing bugs and making my own version of game play, not seen on other servers. ( technologies and tools used: Java, Eclipse, SVN – server; C#/.NET/MySQL - launcher)
  • vLessons – prototype application for a future e-learning application. (Project done as an assignment for courses; technologies and tools used: SQLite, QTCreator, C++)
  • Y! Detector – prototype application that scans a specified Yahoo! Messenger user for being offline/invisible, and retrieving his/her avatar from the Yahoo servers. (technologies and tools: VS, C#)
  • Websites – built many custom websites for friends, companies and my high-school. The latter(http://li.cj.edu.ro) was done using CSS, PHP, HTML, MySQL.
  • XNA Game – currently working on a XNA game with a team, for participating in the Game Design competition at Imagine Cup; Dream-build-play contest and IGF (Independent Games Festival). (website: http://awkwardgames.wordpress.com/shade/)

2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own)

Yes. For the XNA Game I've worked with another friend. For an AI project, I've worked with 2 friends. Both times we used SVN to synchronize our modifications.

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 to the GSOC, because I just got 20, so only starting from last year I could join. The last year I had to be a trainer for a summer training camp (.NET Summer Rally) at the university in my town, and also had the Bacalaureat Exams, so I couldn't work successfully on any GSOC project.

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 am currently not involved with any open source development projects. Even though, about 3 years ago I worked on an open-source project (http://l2jserver.com | http://l2jfree.com) with some friends, modifing the existing files, adding new features and fixing existing bugs, so we could make our own version of the server (if you want you can take a look at an older .diff file here: http://wesnoth.pastebin.com/bGyJ87eY - this was written when my experience/coding style wasn't so good)

2.5) Gaming experience - Are you a gamer?

I like a lot playing games, especially indie ones. Since my first contact with video games I had a NES console. After that the PC, starting with very low configurations to better ones. So, there were games that I played with low graphics mode, but that didn't stop me from playing them.

2.5.1) What type of gamer are you?

There are games at which I'm a master, but there are some games in which I am really bad. I know well the DoTa game - map for Warcraft3 - I was the best in my high-school, and racing games in general. I go mainly for gameplay/story rather than for the graphics.

2.5.2) What type of games?

In the order of "what I like more": mmorpg/Indie/racing/rpg/adventure/shooters. I played too many games to enumerate them, but some of my favorites: Lineage 2, World of Warcraft, Braid, World of Goo, Warcraft3 (Dota), Need for Speed, Unreal Tournament 3

2.5.3) What type of opponents do you prefer?

If it's AI, then I prefer an adaptive one, growing in the difficulty as the game progresses. If it's human, I like all types, including campers because even this type of opponent is good, because it forces you to develop new strategies to try take it down.

2.5.4) Are you more interested in story or gameplay?

It depends a lot on the mood and game type. A fast-paced game (fighting/race/etc) I would like the gameplay to be very good. If It's an adventure for example, I would like it to have a good story.

2.5.5) Have you played Wesnoth? If so, tell us roughly for how long and whether you lean towards single player or multiplayer.

I have played the tutorial only, but surely I will play the campaign and maybe multiplayer, depending on what I will want to do in this project.

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.

Yes.
I have submitted 2 patches regarding the eclipse plugin: https://gna.org/patch/?1585
I have submitted 1 patch for changing the way wesnoth starts, now supporting starting a specified campaign+scenario from command line: https://gna.org/patch/index.php?1625

Also, I have received commit access before the evaluation period (even before the student application period ended) (starting 7th of April 2010).

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

My writing in English is pretty good because I speak sometimes with other peoples, which are not Romanian. Also I spent a week with some students that came in Romania from U.S.; when I was Game Master on the L2Server I had to talk in English and try to understand every "variance" of the standard English, so I think I could understand most of the terms.

3.2) What spoken languages are you fluent in?

Romanian and English.

3.3) Are you good at interacting with other players? Our developer community is friendly, but the player community can be a bit rough.

I'm a very "enduring" when receiving harsh criticisms and I am well-tempered. Is it very hard to upset me. Also I know how to separate feedback (constructive criticism) and useless criticisms.

3.4) Do you give constructive advice?

Yes. Usually I tend to help people in their problems more than necessary, just to be sure of it, by providing feedback and ideas.

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

Somehow between. It depends a lot of my knowledge in that area. If I have enough spare time to try it and know what I have/want to do, I'll do it, providing some results to support my changes. Otherwise, I would wait for the dev guys confirmation.

4) 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 want to work on the Eclipse UMC Plugin. The "official" pages are:

So I will make a tool for editing UMC for Battle for Wesnoth game.

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

I haven't invented one.

4.3) Why did you choose this project?

I chose this project because I've worked before with java/eclipse, so I will have a good start. Also, I like making tools that will help others increase their productivity. Among all project ideas, this was the only one that suited me, and also will give me a fun time developing it.

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 Timeline

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

See Proposal Summary

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

First of all, this project will be done for helping the BfW community + users in creating new content for the game. After that will be the fun of developing alongside with the experience gained from such a project. Also, let's not forget the friends made during GSOC.

4.7) What would make you stay in the Wesnoth community after the conclusion of SOC?

The people I'm working with, the friends made during the "coding" period. If there is need to enhance the plugin I did, I will continue to improve it.

5) Practical considerations

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

  • Subversion (used for all commits)

Yes. I used subversion in 4 projects until now.

  • C++ (language used for all the normal source code)

Yes. I've worked with C++ for 3 years for different projects and programming contests.

  • STL, Boost, Sdl (C++ libraries used by Wesnoth)

STL: I only know a snapshot of what it offers/has. Boost: I only know that they are a collection of different libraries used in almost all domains of software programming. SDL: None at the moment, but willing to learn it, since I have some experience in XNA, switching wouldn't be so hard.

  • Python (optional, mainly used for tools)

No.

  • build environments (eg cmake/autotools/scons)

A little bit of ant only, for the L2Server - building the core/datapack

  • WML (the wesnoth specific scenario language)

No.

  • Lua (used in combination with WML to create scenarios)

No. But wishing a lot learning it.

5.2) Which tools do you normally use for development? Why do you use them?

I like a lot Visual Studio(C#,C/C++), Eclipse(java only) and vim for short and fast C/C++ programs/scripts. Visual Studio is IMHO the best IDE alongside with Eclipse. The only thing why I didn't move completely from VS to Eclipse, is the enhanced debugger of VS and the very low support for C# in eclipse.

5.3) What programming languages are you fluent in?

C#, C/C++, Java

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!

I won't mind. Even though I think it won't be needed, I will provide the telephone number in the application.