SummerOfCodeProposal Achilles Lua

From The Battle for Wesnoth Wiki

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 Lua AI


Achilles - Extend Wesnoth Lua AI Support

I would like to make a simple but efficient interface in which Lua scripts can be easily integrated/edited/removed from the existing C++ core AI system, without effecting existing code. This would allow me to code the AI scripts faster and allow other developers to continue the modification of the AI system later as well.


Achilles, Dexter

SoC Application



1) Basics

1.1) Write a small introduction to yourself.

I am an enthusiatic programmer. I like reading fiction.

I have good knowledge of C++. I am interested in Artificial Intelligence and will be pursuing a Masters in Computer Science, specialising in artificial intelligence.

1.2) State your preferred email address.

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

IRC: Achilles,Dexter Rigved rigved rigvedr

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

I am interested in the idea that "Code is for everyone". Open-source is a novel way to acheive this goal and I view Google Summer of Code as an ideal way to enter in this very exciting area.

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

I am currently studying a Bachelor's degree in Computer Engineering under the University of Mumbai.

I am a Sun Certified Java Programmer. I am currently studying for the Sun Certified Java Developer examination.

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

I am from India.

I will be available from 13:30 - 19:30 (UTC).

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

Yes, I will be having my Semster-end examinations, starting from 2nd week May to 3rd week June. Then, I have my GRE examination in 4th week of July.

2) Experience

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


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


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?


2.4) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement.


2.5) Gaming experience - Are you a gamer?


2.5.1) What type of gamer are you?

I play games in my free time, generally 5-10 hours a week.

2.5.2) What type of games?

Strategy-based, role-playing games. I am a fan of the Warcraft series.

2.5.3) What type of opponents do you prefer?

Ones who are quick to strategise a new method depending on the situation.

2.5.4) Are you more interested in story or gameplay?

Developement-wise: Gameplay.

But I feel the main attraction of a game lies in its 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.We do not plan to favor Wesnoth players as such, but some particular projects require a good feeling for the game which is hard to get without having played intensively.

No. I came to know about it via GSoC.

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 S­­V­­N (during the evaluation period or earlier) please state so.


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.

I am fluent in written English, which is one of the main languages used in my regiion.

3.2) What spoken languages are you fluent in?

I am fluent in spoken English. I can also speak Marathi, Bengali and Hindi.

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 am always polite, even when the opposition would like to demoralise you through rough language.

3.4) Do you give constructive advice?

Yes. If I feel that there is some scope for improvement, then i would readily give my advice.

3.5) Do you receive advice well?

Yes. I am a good listner.

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

Yes. I can understand when the criticism is for my own good or just to 'get one up' on me.

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?

If there is a time-crunch, then I would prefer to discuss a draft of the idea before coding a sample run to see how it works.

If there is no time-crunch, then I would prefer to code a sample run first, so that I may discuss it later with complete understanding of the underlying concept. Even if the idea is thrown away, it may be possible to use the experience gained somewhere else.

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 have selected the following project:

Extend Wesnoth Lua AI Support

I would like to make a simple but efficient interface in which Lua scripts can be easily integrated/edited/removed from the existing C++ core AI system, without effecting existing code. This would allow me to code the AI scripts faster and allow other developers to continue the modification of the AI system later as well.

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

None at this time.

4.3) Why did you choose this project?

I am interested in Artificial Intelligence. I view this project as the ideal entry-point into this very exciting field.

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

Pre - task: Discuss the requirements/specification of the project.

Week 1: Understand core wesnoth AI system and supporting code and discuss the creation of a simple interface (API) to integrate newly created AI scripts written in Lua, as well as support the existing C++ classes.

Week 2: Implement a prototype interface. Use test cases to generate the response from this set of code.

Week 3: Testing this interface in the real game (Lua classes would be tested to see how well they interact with the current C++ classes.

Week 4: Testing this interface (only the Lua classes would be tested to see how well they work when a newly written Lua AI code snippet is run).

Week 5: Diliverable 1 - Efficient system which seperates Lua scripts from code already present. Thus, these scripts can be run independent of the core system but in conjugation with it at the same time. This same concept would allow for two or more AI scripts (systems) to run independent of each other.

Week 6: Discuss the creation of the Lua AI engine which uses the above created interface. This engine will take AI code written in C++ as well as Lua.

Week 7: Implement a prototype Lua AI engine (week 1).

Week 8: Implement a prototype Lua AI engine (week 2).

Week 9: Testing this engine (with sample AI scripts and checking their use in a full game).

Week 10: Testing this engine (in full game scenarios; like playing an AI vs. AI test case to understand how well it has responded to the changes).

Week 11: Diliverable 2 - Fully functioning Lua AI engine (wesnoth now has Lua support, with atleast the same capabilities as the 'earlier AI system').

Week 12: Scrub code, improve documentation etc.

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

The Lua interface would run as a wrapper to the core C++ AI engine. So code containing the Lua scripts can would easily be handled by the Lua AI engine and other code (WML, C++) would be passed to the already existing AI engine to execute as it is.

The AI would also be able decide when to attack and when to defend. For example, if a unit A is under attack from a unit B and if unit A can kill unit B much faster than unit B can kill unit A, then attack unit A, otherwise defend. This follows the policy that "Attack is the best defence".

The Lua interface would have the option of simulating an port of the exsisting core C++ API, of the AI, directly into the Lua AI engine. This is possible as this Lua AI engine is running as a wrapper to the existing AI engine.

One way to extend the core C++ AI libraries to Lua is to create a set of libraries in Lua which encapulate the core C++ libraries, ie., provide the same set of functions. This way, the C++ libraries can still be used while the Lua libraries can also be used.

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?

If the Lua AI engine is continually improved to execute more efficiently and to extend the AI system to supprt more advanced decision-making capabilities, then I would love to continue with wesnoth.

Otherwise also, I am willing to help with testing and submitting patches for future versions.

5) Practical considerations

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

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

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

I would use Lua for Window v. 5.1.4 and Netneans IDE for C++ related developement.

5.3) What programming languages are you fluent in?

C++ and 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!

Skype: rigved.rakshit

Yahoo: r.phate

In general please try to be as verbose as possible in your answers and feel free to elaborate.

This page was last edited on 21 March 2013, at 01:19.