SoC2012 Hankerspace AI Campaigns

From The Battle for Wesnoth Wiki


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



This is a Summer of Code 2012 student page


Description

Thomas Martinet - AI: teach the AI to play Wesnoth's mainline campaigns

As stated in the description, I propose to develop an AI able to complete the campaign alone or in collaboration with a human player.

Your suggestions

  1. move a unit to location
  2. keep a unit alive
  3. keep an ally alive
  4. keep as much money and high-level recalls as possible
  5. do a proper recall
  6. protect units close to level up better.
  7. improve interaction of the player with AI allies.
  8. if you almost lost, try to make it possible for an ally to save you (by retreating the leader and #critical units, for example)
  9. +be able to develop attack strategies
  10. +analyze the game mode of the enemy to counter it

Possible requirements

These are things which could be needed (if yes, then it will be implemented).

  • better defending capabilities (I don't remember if the main campaign requieres it)
  • better recruiting (synergizes with 5.)
  • better AI interface

Yes, those things are other ideas, but with far more limited extent. (As much as is needed to prevent the AI from dying of stupidity)

IRC

hankerspace

SoC Application

Submitted to google

Questionnaire

1) Basics

1.1) Write a small introduction to yourself.

My name is Thomas Martinet, I'm a French 21yo computer science student. I like music, sports and, of course, computer science.


1.2) State your preferred email address.

tmt.martinet[at]gmail.com


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

hankerspace (everywhere)


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

My studies are pretty hard, i don't have enough time to do what i want (especially development). When I was informed that the GSoC existed, I thought it was a chance to spend my summer to develop a concrete project (the one given in studies are not really concrete), learning the team working, commit on the s­­v­­n, have the satisfaction of having succeeded when you research during several hours.


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

I study computer science at UTBM, a French engineering school located in France near Swiss and it's my second semester (on 6 to reach the Engineering Master diploma). I follow courses in Network, Oriented Object programming, Security, Artificial Intelligence, Hardware programming, etc ...


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

I'm from France, during school (until end of June) I'm available some evenings and weekends (daytime).During the summer I will be avaialble from 8h GMT to 22h GMT every day, I think.


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

No, apart my final exams during the month of June (1 week i guess).


2) Experience

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

During some internships and school projects, I've developed

  • C++ program for the communication between an embedded computer (ARM processor) and smart card reader via RS232 (and have to implement some methods to use pin number and write/read on the card) (https://github.com/hankerspace/Projet-BTS-2009)
  • Some C, C++, VB, C# programs created during my studies (few on my github : https://github.com/hankerspace/Divers-programmes-C) and websites with HTML, PHP, Javascript, Ajax, Asp.net created during my studies too ...
  • Really big intern website developed in ASP.NET during an internship (i can't show source code)
  • A lot of sockets/communication programming (most in C, C++, Java)
  • USB communication and Ethernet with a RISC processor and get data to build some charts (in C#).
  • Was really involved in the Mangos project (a World Of Warcraft server emulator), develop some patch, all in C++.
  • Build an AI using Prolog able to complete a Boulder-Dash like game.


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

Yes, the website (with a big software part) during my internship I was in a team of four people with a project manager.


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?

no, it's my first time. I don't know Gsoc at all before this year.


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

As i said, Mangos project and Scriptdev2 project (like an add-on for Mangos). I develop some .patch but i never posted it on the forum because these patch were a total modification of the original development so they wasn't accepted on the S­­V­­N.


2.5) Gaming experience - Are you a gamer?

Yes, i really like video games.


2.5.1) What type of gamer are you?

I played a lot of computer games in my youth but know it's less intensive, my studies don't really allow me to play a lot ...


2.5.2) What type of games?

  • Lot of FPS : Counter Strike 1.6, Call of Duty MW1/2/3, Battlefield 2/3, Crysis 1/2, FEAR 1/2/3
  • RPG : Morrowind, Oblivion, Skyrim, Mass Effect 1/2/3, Fall Out 2/3/4, Neverwinter Nights
  • MMORPG : World Of Warcraft, Vindictus
  • STR : Total Annihilation, Supreme Commander, Warcraft 3 (a lot online), Starcraft 1/2
  • Others : Might&Magic 4/5/6, DOTA, League Of Legends, Wesnoth, GTA, Magicka, Portal 1/2, Sacred, Diablo 1/2...


2.5.3) What type of opponents do you prefer?

I always like campaigns, playing against an AI is really fun for me but humans players are more challenging, i like it in my favorites games.


2.5.4) Are you more interested in story or gameplay?

Both. Some games have a terrible story (or very short) but the gameplay is so funny, like Portal, Campaign is so short ... But if i like the story i play to the game to know the end, as in FEAR 3.


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 began to play to Wesnoth 1 month ago. It was an hasard, and a luck for me. I especially like the single player campaign, i really like to play it again and again, but i don't really play online.


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.

For the moment, only https://gna.org/patch/?3203 , it was a patch to help me to manipulate the source code.


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.

As you can see, far from perfect, i actually follow an English advanced course (i hope it helps me)


3.2) What spoken languages are you fluent in?

In French 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 like it, in some games i have English friends and sometimes we are in a team.


3.4) Do you give constructive advice?

As far as my knowledge permits me but for the moment, in Wesnoth, i think i'm not good enough.


3.5) Do you receive advice well?

I relay like to learn, all advice is good and I expect to take it.


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

I hope, i'm able to differentiate somebody who is angry and says bad things to somebody able to argue his thoughts.


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 learned to work (code) methodically. Make UML diagrams, etc. ... Even if it takes days to solve the problem on paper before moving on to the programming part, I'm like that. But i'm able, if it's necessary to react very fast and think during programming but i think this way is more hazardous ...


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 like AI programming, i really want to concentrate myself on the campaign AI programming, create an IA able to play the solo campaign and with an human player.


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

-


4.3) Why did you choose this project?

I really love AI programming, I've follow some courses (I've created an AI in prolog) and during these, i really know that's what i want to do. I think it's a really good way to improve myself in AI programming. I want to use my strategy skills too (my mother told me that play a lot at Warcraft will not bring me anything in life ...)


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

The Timeline

Date

Description

Importance level

May 9 – May 17

Mid-term school exam session

-

May 18 – June 15

*Be able to know all the AI programming in Wesnoth, take notes on the most important files, current ways of AI and Lua functions available.

Compulsory

June 16 - June 30

Final school exam session

-

July 1 - July 9

School ended, fully available. Gather low-level Lua function sequences into higher level function libraries (e.g. move() -> wait() -> move() = patrol())

Hight

July 10 – July 15

Begin the developpement of the main AI which can be able to complete the campaigns. A lot of thinking concerning the battlefield and a lot of variables (ennemy race, objectives, castle locations ...) .

Compulsory

July 16 – August 1

The AI will be functional but not necessary able to complete ALL the campaigns, maybe a lot of death in a first time.

Compulsory

August 2 - August 10

Improvements and strategic thinking to be able to successfully complete campaigns.

Compulsory

August 11 – August 20

Begin the development of a cooperation AI, able to react to allies moves.

High

August 20 – August 31

Completion of work and clean the project

Compulsory

September 1 – September xx

Back to school, support the project especially if mistakes will be detected in my work.

-

  • I have a lot of school projects to complete during this period, i can't be fully functional.


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

After a lot of conversations with Crab_, i'll try to explain some technical details :

  • LUA implementation
    • Firstly, i want to add some high-level functions (cf timeline) using low-level sequences.
    • Secondly, implement new AI functions (eg : keep a lot of money, prevent a unit from dying, etc ..)
    • Thirdly, using the requirements of an AI, trying to build a complete LUA library with all the high-level functions which we need for an AI (eg : regroup recruitement functions, capture functions, retreat, engage a fight, find best objectives, counteract the ennemy strategy, etc ...)


  • WML implementation
    • Using my LUA work, extend current [goal] tag with a lot of new types :
      • Keep a lot of money
      • Prevent a unit from dying
      • Defense perimeter
      • A lot of other stuff ...
    • Improving actual WML tag with general parameters
      • Minimum number of villages have
      • Ways of playing (as a turtle, as a rusher, etc ..)
      • ...
    • Add real time reactions
      • When undergoes a surprise attack
      • When the enemy have more troops and some points can't be defended (retreat)
      • If the objective is an unit and this unit is not in its base.


  • In game implementation
    • Using all these new stuffs to create the in-game AI
    • Be able to play with an ally
    • Be able to cooperate with this ally (common objectives ...)



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

  • Know how really work a big open-source project and be able ton involve myself in.
  • Learn a lot of things about AI programming.
  • Want to work with people of different nationalities
  • Want to give my summer for a real project that will be used for a while


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

My next semester (autumn 2012) will be a 6-month internship, I think i'll have a lot of time during evenings so if my work was satisfactory (and i hope), i'm ready to continue to stay in Wesnoth community.


5) Practical considerations

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

  • Sub­­version (used for all commits)
    • Yes a lot, in school projects or during my own developments
  • C++ (language used for all the normal source code)
    • Yes, i'll have to do a C++ project in May i guess, i'll show it to you.
  • STL, Boost, Sdl (C++ libraries used by Wesnoth)
    • STL and Sdl a lot but i worked less with Boost.
  • Python (optional, mainly used for tools)
    • Yes, follow a conference last week about Python
  • build environments (eg cmake/scons)
    • I have used these tools before but never created by myself.
  • WML (the wesnoth specific scenario language)
    • I have created a patch it seems really easy to learn, especially with the Wiki.
  • Lua (used in combination with WML to create scenarios)
    • I know a little bit, but i'll follow some tutorials to be better


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

  • Code blocks for C, C++ programming (Love this IDE !)
  • Gobby, really nice IDE too, I use it on Kubuntu
  • Notepad++ (unavoidable)
  • Work on Linux and Windows
  • Quassel IRC (yes, it's a development tool)
  • And Google Chrome for Pastebin, etc ...


5.3) What programming languages are you fluent in?

C#, VB.NET, VB, C++, C, SQL, HTML, CSS, PHP, JavaScript, WLangage, Shell Unix, Prolog, LISP, Java, Python and Pascal (even if i don't use the last 2 since a while)


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!

No problem, I have Skype or a Teamspeak server for vocal communications too.

This page was last edited on 21 March 2013, at 03:15.