FormulaAIAbstractLevel

From The Battle for Wesnoth Wiki
Revision as of 12:45, 30 March 2008 by Lisu (talk | contribs) (Experience)

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'm (or I was) leader of team preparing it. It wasn't big project (7 participates, 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 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'd prefer XP programming (recently I write in pair with my friend Jarek102, it creates better code, because we are good in different things). 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's not the same, I've also tried FreeCiv) bring my memories. I've 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've spent much time playing Heroes III multiplayer, or Civ IV. But I don't like RTS, because usually I'm not that fast. I've also spent some time playing Wesnoth multiplayer, with some of my friends (I'm 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 not bad anyway considering fact, that in Heroes computer players always KNOW WHOLE MAP.

Are you more interested in story or gameplay?

I thing both is important to create good game. I've played multiplayer campaign in Wesnoth but it has finnished after second mission. I think that's 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've not played much. I know this game from few weeks, my friend told me about it. As I've mentioned before, I'd rather prefer multiplayer campaigns, if there were more of them. Actually last few days I've played for 10-12 hours, which isn't 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've worked two summers in the UK, so I'm available to speak let's say fluently in this language. It this obvously easier 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 don't have a problem in interacting with other people.

Do you give constructive advice? 

I'm trying to. Usually I attach arguments to my advices. It is always easier to think of a better solution of a problem when you can consider as many agruments as it is possible.

Do you receive advice well? 

Again, I'm doing my best to analyze my mistakes, and receive advices to make my work as good as it is possible

Are you good at sorting useful criticisms from useless ones?

Usually justification makes the difference, although it's hard task. I'm trying to be not to 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 I'll call StrategyAI level. As you can see on the picture , we've got C++ FormulaAI implementation, then we have Python scripting, now it's time for the next level which could give every user the tool to modify AI to his needs (especially a campaign author). Basicly my idea consists of three parts. I must add that I would like to extend existing FormulaAI, rather than replace it.

  • Situation Analysis

First extend 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 imporant 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 what FormulaAI does today, depending on situation data it makes moves. 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 me mixed in free way. For example Recruitment AntiUnits would be function which evaluating (using Sit. Analysis) what units have the opponents, and then Recruit anti Units. Obviously as a optional parameter function gets Dictionary of units and antiUnits (but it may use it's own built in). Extending this part to a framework that covers as many strategies as it is 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 Adaptation of an algorithm. For now it's 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. Now 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's why first idea is better, but harder in technicall implementation.

Now it's 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 a XML file (which is very easy to edit, even Eclipse have an 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've mentioned before, that is easy to edit and mix up.

Time Line

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. April 14 - May 26: Community Bonding Period - Here I'll 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 importantly).

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've got classes at my University at the same time, which includes few projects in this semester. It shouldn't mainly interrupt my work for Wesnoth, but at this time I can't sacrifice amount of time that I'd 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 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) - should be done before 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 to 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'll start shortly after first code analysis, and conversations with players)

July 14 - August 18: There is a Summer break on my Univesity then, so I can be focused on SoC (which may include 40 hours of work a week, good money expects 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'm oppenned to any critisism that is needed to make good software.

After SoC I'd like to extend adaptation system (maybe create a server with parameter files, why is that? I'm interested very much in this part of the work. I'd like to improve it. I'd also apreciate 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'm 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've seen good working committe. I would like to be a part of it and I'll do my best in what I'm 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 looks like it.

Practical considerations

Are you familiar with any of the following tools?
      • Subversion I've worked with subversion from about two years.
      • C++ yes, from about two years I write programms in C++.
      • Python I've 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 don't like Eclipse plugin for Python it's strange).

What programming languages are you fluent in?
      • Python (3 years)
      • C++ (2 years)
      • Java (last semester)
      • PHP (4 years)
      • Pascal (I know it from 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 wouldn't 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?