Difference between revisions of "SummerOfCodeProposal AI Improvement Crab"

From The Battle for Wesnoth Wiki
m (Patches and commits: added info about AI-hot redeployment and updated my next plans)
m (Patches and commits: typo)
Line 83: Line 83:
 
[[https://gna.org/patch/?1137 Patch 1137]] I've implemented FormulaAI function run_file - which adds ability to run .fai file directly from in-game console, which allows efficient debugging of the .fai files<br/>
 
[[https://gna.org/patch/?1137 Patch 1137]] I've implemented FormulaAI function run_file - which adds ability to run .fai file directly from in-game console, which allows efficient debugging of the .fai files<br/>
 
[[http://svn.gna.org/viewcvs/wesnoth?rev=34200&view=rev r34200]] - I've fixed incorrect handling of poisoning attacks when suggesting best attack in user interface.<br/>
 
[[http://svn.gna.org/viewcvs/wesnoth?rev=34200&view=rev r34200]] - I've fixed incorrect handling of poisoning attacks when suggesting best attack in user interface.<br/>
[[http://svn.gna.org/viewcvs/wesnoth?rev=34298&view=rev r34298]] - I've added basic history and hot-redeployment capabilities to formula console, reworked AI lifecycle management and AI configuration management. That patch alone was more that 2000 lines long.
+
[[http://svn.gna.org/viewcvs/wesnoth?rev=34298&view=rev r34298]] - I've added basic history and hot-redeployment capabilities to formula console, reworked AI lifecycle management and AI configuration management. That patch alone was more that 2000 lines long.</br>
 
<b>My immediate work plans:</b><br/>
 
<b>My immediate work plans:</b><br/>
 
- [[AI_Arena| create a framework to easily test the AIs in specified situations]] (I currently work on the code to allow AI redeployment)<br/>
 
- [[AI_Arena| create a framework to easily test the AIs in specified situations]] (I currently work on the code to allow AI redeployment)<br/>

Revision as of 20:24, 30 March 2009

Hello

My name is Yurii, My nick on IRC is Crab_, my nick on forum/wiki is Crab, on gna - crab.

terraninfo АТ terraninfo.net

Proposal Summary

I would like to reorganize the current AI subsystem to allow different people collaborate more efficiently on creating new AIs and improving AIs.

Also, I would like to make the Wesnoth AI better.

I propose a three-part project:

1)

- I will refactor the AI subsystem to make it more manageable and modular.

- I will create the AI testing framework, both for unit testing (testing specific AI components), non-interactive testing (from the command-line) and interactive testing (in-game, by the developer). This will provide a way for regression testing of any changes to the AI. This is very important for AI development.

- I will make a library of base FormulaAI functions which will be aware of the basic AI tune options and honour them. This will be used to make the formulas respect the wishes of the scenario designers.

2)

- I will use that testing framework to make standard AI better without risk of breakage. I will do so by fixing bugs in it and adding modularity to allow behavior of its specific parts to be replaced (those bugs cannot be fixed now, without risk of regression - for improving one area of the AI can break another)

- I will increase FormulaAI capabilities, by introducing .fai library and namespace support, increasing debug capabilities

- I will also create a FormulaAI debugger\profiler, to allow stepping through formulas, setting breakpoints, tracing and profiling, etc.


3)

As I expect (1)-(2) to be finished early (till July), I will use the rest of the SoC time to implement my ideas about a new C++ AI.

Some thoughts about the AI:

- I think that writing a good AI in FormulaAI is not possible without improvements in underlying C++ code (in particular, it should allow pluggable C++ 'candidate move testing and execution' implementation.

- I think that the AI must know the rules of the game and the consequence of it's actions.

- I will try to construct AI components which will use an extendable decision loop (SEE what the situation is -> EVALUATE it -> DECIDE what to do-> EXECUTE and EXPECT some results -> return to SEE what actually happened -> ...)

The task will be slightly easier because many trivial parts of it can be copy-pasted from current codebase.

I'm preparing a small demonstration of my AI ideas at the moment (I'm highly specializing it to make it quickly)

Timeline

+ Mar 19 - Mar 22 Familiarize myself with important parts of current Wesnoth AI code and Wesnoth way of doing things.
+ Mar 23 - Mar 27 Discuss implementation ideas and details. Fix some more bugs. Gain SVN commit access.
now Mar 28 - Apr 2 Improve formula AI debugging capabilities and improve the AI lifecycle handling to allow AI hot-redeployment. Clean up current mess with ai parameter handling in team.cpp (without breaking anything, that is). Also, To prove that I am able to write AIs, I will write an interesting working demonstration of the AI ideas I am trying to implement.
April 3 - April 10 Write extended proposed AI redesign description and create the AI testing framework.
April 11 - April 20 Use that testing framework to fix bugs in current AI and begin to refactor the current AI to be more modular.
April 21 - June 10 Redesign current AI and FormulaAI code, split them into layers with defined responsibility, make the code cleaner, modular, and simpler, write a library of formula AI functions which will respect basic AI tuning parameters, introduce namespaces and .fai libraries into formula AI. Ask those students who will work on stats.wesnoth.org to organize collection and presentation of the info about AI behavior and efficiency.
June 11 - July 10 Write a good Formula_AI debugger.
July 11 - August 10 Implement my AI ideas in C++.
August 11 "'pencils down' date. Take a week to scrub code, write tests, improve documentation, etc." (c) google
Afterwards - continue to improve the AI


I've got an unique opportunity to improve Wesnoth because I am a last year student and my exams are already over (they were in February-09), and I have no lectures to attend and almost none university work to do - that means I am 90% free to improve Wesnoth (remaining 10% being my teaching practice, coordinating the work of several student developeres, and working towards my diploma). I'm able to work on improving Wesnoth 6 days a week (remaining day being my Sunday D&D session - I've been a D&D DM for 9+ years.), and hacking some code for 12+ hours per day is the thing I love:) So, I can easily devote 48+ hours to Wesnoth each week, even now.

I will need this time because AI is quite hard to do right. But I am confident in my abilities and my determination.

Patches and commits

I've earned a svn write access to the Wesnoth source repository on Mar 27.
I've already contributed some patches to make debugging easier and to fix some crashes related with FormulaAI.
[Bug 13218] - I've spotted and fixed an infinite loop (which hangs the game) in the AI if it persistently tries to move unit to occupied square, with a hint from Sirp and some help from Dragonking
[Bug 13230] - I've implemented one of the FormulaAI debugging-related suggestions on the EasyCoding page, under the guidance of boucman.
[Bug 13229] - I've fixed two small 'past-end-of-collection-dereference' bug in FormulaAI
[Patch 1136] -I've submitted a patch to fix a segfault in FormulaAI formula parser.
[Patch 1137] I've implemented FormulaAI function run_file - which adds ability to run .fai file directly from in-game console, which allows efficient debugging of the .fai files
[r34200] - I've fixed incorrect handling of poisoning attacks when suggesting best attack in user interface.
[r34298] - I've added basic history and hot-redeployment capabilities to formula console, reworked AI lifecycle management and AI configuration management. That patch alone was more that 2000 lines long.
My immediate work plans:
- create a framework to easily test the AIs in specified situations (I currently work on the code to allow AI redeployment)

Answers to those questions


Basics

Write a small introduction to yourself.
Hello. My name is Yurii Chernyi. I am 23, and I live in Kiev, Ukraine. I study applied math at the Faculty of Cybernetics, Kiev University.

1.2) State your preferred email address.
terraninfo АТ terraninfo.net

1.3) If you have chosen a nick for IRC and Wesnoth forums, what is it?
IRC: Crab_
Wesnoth forums: Crab
Wesnoth wiki: Crab
GNA: crab

1.4) Why do you want to participate in summer of code?
I would like to make the world better and I've got some free time for this. I think that GSoC is a good opportunity to try to solve interesting problems.

1.5) What are you studying, subject, level and school?
Applied Mathematics, 6th year, Faculty of Cybernetics, Kiev University, Ukraine.

1.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 Wesnoth. If you have gained commit access to our SVN (during the evaluation period or earlier) please state so.
Yes, I've contributed some patches and fixed some bugs. I've earned commit access to Wesnoth svn on March 27. See My Patches and commits

Experience

good practical knowlegge of C++, Java, computer science concepts, networking, system and database administration.

2.1) What programs/software have you worked on before?
Mostly, I've done website development using Java EE. Also, I've done various C++ projects in regarding numeric computations (for example, in computational fluid dynamics)

2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own)
Yes, I'm familiar to team development, and, at present, I coordinate a team of student developers for a small university project.

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 haven't participated in the GSoC before. This is my first and last (I graduate this year) chance to participate.

2.4) Open Source

2.4.1) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement.
I use a lot of open source, but Wesnoth is the first open source project I am involved with.

2.5) Gaming experience - Are you a gamer?
Yes, I am a gamer )

2.5.1) What type of gamer are you?
I'm not really sure what this question is about, but I'll try to answer: I prefer to think out a plan, and then execute it. So, according to http://www.quizilla.com/quizzes/result/532090/375850/, I'm a 'strategic gamer'.

2.5.2) What type of games?
I prefer strategy games, both turn-based and realtime.

2.5.3) What type of opponents do you prefer?
Those who play well and are challenging to beat. Those can be both human or computer players.

2.5.4) Are you more interested in story or gameplay?
It depends on gameplay. Some games are worth playing once - to see the story unfold. Some games are interesting to play even without the 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.
yes, I've played Wesnoth, from version 1.4.2. I've finished all single-player campaigns that were in the base install, some of them several times on different difficulty levels. I've played a bit of multiplayer in hot seat mode.

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 think I can read and write English quite well. This wiki page can serve as an example :)

3.2) Are you good at interacting with other players? Our developer community is friendly, but the player community can be a bit rough.
That is yet to be seen, but I expect no problems. Being a player myself, I understand their desires )

3.3) Do you give constructive advice?
Yes, I personally think that I can give constructive advice.

3.4) Do you receive advice well?
Yes, especially if it is constructive :)

3.5) Are you good at sorting useful criticisms from useless ones?
Yes, I am.

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?
Yes, I looked through that list and I think it will be really hard and interesting to improve the AI (and the AI needs that improvement :) ).

4.2) If you have invented your own project, please describe the project and the scope.
My project is within the scope of 'improving AI and making it easier to tune its behavior' idea.

4.3) Why did you choose this project?
I want to make the AI feel more intelligent and I want it to be more fun to compete with. I would be happy to see Wesnoth with a better AI and I think I could make it better. Also, I want tweaking AI for specific scenarios to be a fun job, not a nightmarish formula debugging experience for scenario developers without programming background.

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 My proposal summary

4.6) What do you expect to gain from this project?
Knowlegge that I have done a good thing, satisfaction playing a better Wesnoth, and a bit of money from Google (I can probably earn more if I would work elsewhere as a full-time developer, but programming for Wesnoth is much more fun :) ).

4.7) What would make you stay in the Wesnoth community after the conclusion of SOC?
I will stay and continue to improve the game.

Practical considerations

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

* Subversion (used for all commits)
yes, both with command-line and gui.
* C++ (language used for all the normal source code)
yes
* Python (optional, mainly used for tools)
no, although I've worked with python code on several occasions and I can read it quite well.
* build environments (eg cmake/autotools/scons)
'make' - yes, 'scons' - learned a bit while looking at Wesnoth build system. 'autotools' - no, but I know its purpose and I think it will be easy for me to learn to use it, if it becomes necessary. Using scons is all that I needed so far to compile Wesnoth.

5.2) Which tools do you normally use for development? Why do you use them?
vi, gdb, find, fgrep, small shell scripts, svn, git, Eclipse under GNU/Linux; Visual Studio and Eclipse under Windows. My work machine is a notebook running Debian GNU/Linux.

5.3) What programming languages are you fluent in?
I am fluent in Java (4+ years of experience) and C/C++ (4+ years of experience) I know a bit of php/perl/sh/sed/awk/javascript/pascal

5.4) What spoken languages are you fluent in?
I can speak in Ukrainian (native), in Russian (native), English.

5.5) At what hours are you awake and when will you be able to be in IRC (please specify in UTC)
I'm in UTC+2 timezone. I am normally awake from +10 UTC to +02 UTC, and most of that time I'm at home, so I'm able to be in IRC.

5.6) 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.
Of course, we can talk by phone.