FormulaAIAbstractLevel

From The Battle for Wesnoth Wiki
Revision as of 23:50, 20 March 2013 by Esr (talk | contribs) (Hide historical references to Subversion from the wiki search function)

Basics

Write a small introduction to yourself.

I'm Mateusz Lis, 3rd year student from Wroclaw University of Technology, Poland. I'm interested in everything what's connected to Computer Science. Recently I have spent much time on pattern recognition.

State your preferred email address.

mateusz.lisATTgmail.com

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

lisu (sometimes on IRC lisu_)

Why do you want to participate in summer of code?

I'd like to extend my programming experience, to finally involve in some big open source project. It would be also good if I invented good Artificial Inteligence for Wesnoth, it would be perfect if it could beat myself. I think that could be fun.

 What are you studying, subject, level and school? 

3rd year of Computer Science, Wroclaw University of Technology, Poland.

Experience

 What programs/software have you worked on before?

Beyond some small projects on my university I was the leader of programming group creating OCR system in Python (SnakeReader, available on code.google.com). Project is frozen now, because we had to face some problems connected to the efficiency of this language. I'm also a developer of commercial Content Management System (YaCMS).

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

In SnakeReader I am (or I was) leader of team preparing it. It was not a big project (7 participants, all from my univesrity). In YaCMS I work with couple of my friends to create CMS for company.

 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?

It is my first time that I apply to GSoC.

What development model would you use (e.g. keywords: V-model, XP programming, agile programming, iterative; with the help of prototyping, formal specifications, tests, etc).

I would prefer XP programming (recently I have programmed in pair with my friend Jarek102, it creates better code, because we complement one another). We use unit tests.

Open Source

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

Because works on SnakeReader are stopped I must say no (we are currenlty considering re-writing part in C).

Gaming experience

Are you a gamer?  If so...

Ofcourse

What type of gamer are you?

hmmm, fast?

What type of games? 

Actually I was playing more when I was younger. Titles like Heroes Of Might And Magic II and III, or Civilisation II (now I like IV, but it is not the same, I have also tried FreeCiv) bring my memories. I have also played much in C&C (Command & Conquer) Series, up to Red Alert II. So mainly Turn based strategies and RTS games.

What type of opponents do you prefer? 

It depends, I have spent much time playing Heroes III multiplayer, or Civ IV. But I do not like RTS, because usually I am not that fast. I have also spent some time playing Wesnoth multiplayer, with some of my friends (I am still not the best) and I prefer it to single player games, because computer opponents are not the best ones. But I must say it is not bad anyway considering the fact, that in Heroes computer players always KNOW WHOLE MAP.

Are you more interested in story or gameplay?

I think both is important to create a good game. I've played multiplayer campaign in Wesnoth but it has finnished after second mission. I think that it is a good idea to develop.

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

I have not played much. I know this game for a few weeks, my friend told me about it. As I have mentioned before, I would rather prefer multiplayer campaigns, if there were more of them. Actually last few days I have played for 10-12 hours, which is not good...

Communication skills

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 have worked two summers in the UK, so I am available to speak let us say fluently in this language. It is obvously easier for me to write, however I make mistakes.

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

I do not have a problem in interacting with other people.

Do you give constructive advice? 

I am trying to do so. Usually I attach arguments to my advice. It is always easier to think of a better solution of a problem when you can consider as many agruments as possible.

Do you receive advice well? 

I am doing my best to analyze my mistakes, and receive advices to make my work as good as possible

Are you good at sorting useful criticisms from useless ones?

Usually justification makes the difference, although it is hard task. I am trying not to be emotional in professional life.

Idea Description

In my opinion most important thing now is to create one more abstract level over the FormulaAI which from now on I will call StrategyAI level. As you can see on the picture , we have got C++ FormulaAI implementation, then we have Python scripting, now it is time for the next level which could give every user the tool to modify AI to his needs (especially a campaign author). Basically my idea consists of three parts. I must add that I would like to extend existing FormulaAI, rather than replace it.

  • Situation Analysis

First extension I want to reach, is to create new set of tools responsible for good situation analysis. As you can see on the picture ([1]) Situation Analysis consists of some smaller parts, which actually ought to be functions included in the new library. Here we could apply some knowledge from pattern recognition (f. e. applies to map). What I want to achieve is the situation in which you use high level instructions from the "Situation Analysis Library" rather than any low level instructions to get the important information about current (and future) situation on the map. Separating this part from the main stream gives us some advantages like easier extendability, but most important is that (if good enough) it gives us chance to leave the low level instructions, so it makes building our high level of abstraction possible.

  • Decision Making

Next thing on the picture is Decision Making, this would be like something which FormulaAI is today, it makes movements depending on the situation data. This is a part where you can still make a Python program which actually manages all AIs units. But here I would like to create another toolkit, which could create something like Strategy rule set, which consists of things like

    • Overall (Offensive, Defensive)
    • Objective (Protect(Unit, Place, Sth Different), Kill(Unit1,Unit2), HelpAlly(NumberOfAlly))
    • Recruitment (UserDefined, AntiUnits, FastGrow)
    • Units Formations (serried, fragmented)

which might be mixed in customizable way. For example Recruitment AntiUnits would be function which evaluating (using Sit. Analysis) what units have the opponents, and then Recruit anti Units. Obviously function gets Dictionary of units and antiUnits as an optional parameter (but it may use its own built in). Extending this part to a framework that covers as many strategies as possible could make defining your own AI very easily, and hopefuly enough advanced. What is more, aim is to create system in which you can set for instance 30% AntiUnits 70% Fastgrow, which means depending on Situation Analisys, AI will use moves suggested from one scheme or another.

  • Adaptation Algorithm

Last but not least thing is the Adaptation of an algorithm. For now it is planned to be based on very simple but succesful idea applied in neural networks. I mean, when we have some factors, which are defining our situation (from Sit. An. lib) we can assign weights (importance parameters) to them which we call parameters. When AI plays the match and loses using some strategy it means, that wrong factors were considered, so it changes parameters assigned to them and next time playing the game factors have different (more or less important) meaning. The disadvantage is, that there are two ways of achieving it, in one way we create central server with parameters for our artificial model, and then everyone who plays against it, connects to the server and upload his results, or is independent for every user, so everyone could train his AI himself and then share it to others, but it probably would take much time. That is why first idea is better, but harder in technicall implementation.

Now it is time for StrategyAI level which simply uses first two of the tool sets, to create a new customizable strategy. In my basic Idea it could have a form of an XML file (which is very easy to edit, even Eclipse have a visual editor for XML trees, when you have specified dtd file, anyway I could write something like that). For instance XML file could look like that

<?xml version = "1.0" encoding = "UTF-8"?>
         <!DOCTYPE StrategyAI SYSTEM "stratAI.dtd" >
         <OBJECTIVE KillAll=100/>
         <OVERALL Offensive=70 Deffensive=30/>
         <RECRUITMENT AntiUnits=100>
                     <Unit u=Mage>Tree</Unit>
                     <Unit u=Dark Sorcerer>Drake Gladiator, Drake Slasher</Unit>
         <UNITSFORMATION Serried=100>
                     <FirstLine>Drake Gladiator</FirstLine>
                     <Back> Mage</Back>

The advantage of the tree is you can simply express many situations using it. The advantage of XML format is, as I have mentioned before, that it is easy to edit on one hand and very powerful on the other hand.

TimeLine

According to Google: April 1 - April 14: Enjoying Wesnoth multiplayer and analyzing multiple AI strategies, try to make my own *.py AI, write 2 easy code and one not so easy code patches. Analyze the code April 14 - May 26: Community Bonding Period - Here I will need to make some community research, get to know what are most popular strategies, examine division of Situation Analysis Part (or Decision Making as well). Besides here I have to, like Google says, get to know with mentor, and code (most important).

May 26 - July 14: Students are coding for their GSoC projects. July 14 is also final date to submit mid-term evaluation.

Mid-term Evaluation is one of the hardest things for me, just because I have got classes at my University at the same time, which includes a few projects in this semester. It should not mainly interrupt my work for Wesnoth, but at this time I cannot sacrifice as much time as I would like to. I think 1-3 Days a week depending on week should be enough to achieve some basic goals which include:

  • Basic functionality of Situation Analysis, which includes simple functions like map analysing or seeing opponents units (note, that this means that till this time there will be also system to feedback results of analysis from first library to Decision Making part, something like communication protocol, but not in that sense) - it should be done before the end of June
  • Upgrade some FormulaAI code, to fit my expectations (described on the picture ([2]) ). Most important here will be recruitment and forced moves (to fit the camaign authors) - start shortly after the bonding period (to analize the code) and then it will wait till the end of June, should be done before Mid - Term
  • Plan interface of the Strategy AI - Made in the very begining of June (actually I will start shortly after first code analysis, and conversations with players)

July 14 - August 18: There is a Summer break at my Univesity then, so I can be focused on SoC (which may include 40 hours of work a week, good money is worth good and efficient work).

Before final evaluation I would like to achieve all goals described in the previous part of this document. However, there might be some changes, please note, that the idea might change a little after mentors or players advices, I am opened to any criticism that is needed to make good software.

After SoC I would like to extend the adaptation system (maybe to create a server with parameter files) because I am interested very much in this part of the work. I would love to improve it. I would also appreciate if I could be maintainer of the AI part of Wesnoth.

Project

Did you select a project from our list? If that is the case, what project did you select?

FormulaAI extension.

Why did you choose this project?

I am interrested in Artificial Inteligence methods, and I know, that creating a game, especially this kind of game, can give me satisfaction. It is always easier to motivate myself, when I can see efects of my work. What is more convincing, when I had a better look on this project, I saw a good working committee. I would like to be a part of it and I will do my best in what I am good at.

What do you expect to gain from this project?

First of all I expect to gain new experience working in big project, being responsible for important part of it, and to achieve profficiency in playing Wesnoth...

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

Succes. I mean, I want to participate in big project, that motivates me to work. And this sounds like it.

Practical considerations

Are you familiar with any of the following tools?
      • Sub­­version I have worked with sub­­version from about two years.
      • C++ yes, from about two years I write programms in C++.
      • Python I have started with Python 3 years ago, and I must say I like this language.
Which tools do you normally use for development? Why do you use them?

Eclipse for C++, PHP and Java. Eric's Python Ide for Python (I do not like Eclipse plugin for Python it is strange).

What programming languages are you fluent in?
      • Python (3 years)
      • C++ (2 years)
      • Java (last semester)
      • PHP (4 years)
      • Pascal (I have known it for about ten years)
What spoken languages are you fluent in?

English, Polish.

At what hours are you awake (please specify in UTC)

10:00 AM - 1:00 PM

Would you mind talking with your mentor on telephone / internet phone? 

I would not mind. It may be helpful.

  • Detailed answer (optional, but writing skill is a good predictor of ability to work on a programming team, so you will improve your chances by responding to this).
    • Write a small essay (750-1000 words or more) explaining why you want to participate in a Wesnoth GSoC project. You can use the above questions as guides, but feel free to throw in more information if you feel it is relevant.
    • What is your perception of 'open source'? Briefly explain what you think of the whole 'open source' concept, how you discovered open source, what you expect to gain/experience by participating in an open-source project. (Answer separately or as part of above mini-essay)
    • What motivates or inspires you to write programs and develop software?