Difference between revisions of "SoC2014 kevin AI"
Line 2: | Line 2: | ||
[[Category:SoC_Ideas_AI_Global_strategy]] | [[Category:SoC_Ideas_AI_Global_strategy]] | ||
==Attention== | ==Attention== | ||
− | <p>This page will be continuously modified and updated | + | <p>This page will be continuously modified and updated.</p> |
==Description== | ==Description== | ||
<h4>Kevin Xi - AI: Improve AI by implementing global attack/retreat decision</h4> | <h4>Kevin Xi - AI: Improve AI by implementing global attack/retreat decision</h4> | ||
− | <p>A | + | <p>A rule-based expert system style solution</p> |
==Idea== | ==Idea== | ||
− | <p> | + | <p>All decisions of AI have three global strategic goals to achieve: hit enemy as heavy as possible, take villages as much as possible, protect self as cautious as possible. These three goals ideally should be achieve in every single action but they may conflict with each other, so these goals need to be associated with priority.(p1: hit enemy, p2: grab villages, p3: protect self). The results of these three goals is a bunch of actions, for example, to achieve "hit enemy" goal, the "actions to deal with enemy"(this is a CA) will be executed, that may contains "find a good place to attack", "just stand there but not attack to prevent the enemy escape next turn", "recruit unit suit for battle", etc. And the actions to deal with village may contains "recruit scout-like unit", "let the resilient unit to guard the village", "let the unit with heal ability stand behind", "block enemy from near the village", etc. The actions to deal with protecting may contains "give up village if I have more than enemy", "stand behind the resilient unit", "retreat to the zero power-projection contour line", etc.</p> |
− | <p> | + | <p>The priority is not constant, it is a function of the battlefield situation. For now I just focus on time-space-economy(that is, time of day-terrain-gold and villages) because I think these are the three factors that influence all units in the battlefield and tightly associated with three goals.</p> |
− | <p> | + | <p>If in this turn, p1+p2-p3>0, the AI think it is worth to attack, otherwise it retreats.</p> |
− | <p> | + | <p>About the attack/retreat position: when I consider the question on"where to retreat", I am thinking about a kind of "Damage contour map", that is, each location of battlefield is associated with the damage the unit may bear at this location, that can be calculate by power_projection(I hope it can combine with defense of certain unit type at this terrain), Then circle the roughly same value to get a contour map and let unit to stand by a contour line that they can bear the damage on that line. Hopefully if enemies form a line, the same value positions on contour map may also be a line, so AI can form a line in this way. But when some of them punch into the middle of the AI's line, let units retreat to one single side which is near to their leader(so they will not run in every direction, that will leave the path free to its leader), and see if it is good to abandon unit that be surrounded, according to the HP, EXP and gold. So it hopefully form a skirmish line without hard-coding the rules about forming line.</p> |
− | <p> | + | <p>Actually, I hope to implement CAs that form strategies by its own without hard-coding, only given the battlefield situation. The closest approach as far as I can see is to find patterns inside the rules, which is related to the three strategic goals.</p> |
− | |||
− | |||
==IRC== | ==IRC== |
Revision as of 12:02, 24 March 2014
This page is related to Summer of Code 2014 |
See the list of Summer of Code 2014 Ideas |
This is a Summer of Code 2014 student page |
Contents
Attention
This page will be continuously modified and updated.
Description
Kevin Xi - AI: Improve AI by implementing global attack/retreat decision
A rule-based expert system style solution
Idea
All decisions of AI have three global strategic goals to achieve: hit enemy as heavy as possible, take villages as much as possible, protect self as cautious as possible. These three goals ideally should be achieve in every single action but they may conflict with each other, so these goals need to be associated with priority.(p1: hit enemy, p2: grab villages, p3: protect self). The results of these three goals is a bunch of actions, for example, to achieve "hit enemy" goal, the "actions to deal with enemy"(this is a CA) will be executed, that may contains "find a good place to attack", "just stand there but not attack to prevent the enemy escape next turn", "recruit unit suit for battle", etc. And the actions to deal with village may contains "recruit scout-like unit", "let the resilient unit to guard the village", "let the unit with heal ability stand behind", "block enemy from near the village", etc. The actions to deal with protecting may contains "give up village if I have more than enemy", "stand behind the resilient unit", "retreat to the zero power-projection contour line", etc.
The priority is not constant, it is a function of the battlefield situation. For now I just focus on time-space-economy(that is, time of day-terrain-gold and villages) because I think these are the three factors that influence all units in the battlefield and tightly associated with three goals.
If in this turn, p1+p2-p3>0, the AI think it is worth to attack, otherwise it retreats.
About the attack/retreat position: when I consider the question on"where to retreat", I am thinking about a kind of "Damage contour map", that is, each location of battlefield is associated with the damage the unit may bear at this location, that can be calculate by power_projection(I hope it can combine with defense of certain unit type at this terrain), Then circle the roughly same value to get a contour map and let unit to stand by a contour line that they can bear the damage on that line. Hopefully if enemies form a line, the same value positions on contour map may also be a line, so AI can form a line in this way. But when some of them punch into the middle of the AI's line, let units retreat to one single side which is near to their leader(so they will not run in every direction, that will leave the path free to its leader), and see if it is good to abandon unit that be surrounded, according to the HP, EXP and gold. So it hopefully form a skirmish line without hard-coding the rules about forming line.
Actually, I hope to implement CAs that form strategies by its own without hard-coding, only given the battlefield situation. The closest approach as far as I can see is to find patterns inside the rules, which is related to the three strategic goals.
IRC
Kevin_Xi
Questionnaire
1) Basics
1.1) Write a small introduction to yourself. Hi, I am Kevin, a junior Software Engineering student in Beihang University. I love open source, I use and learn from it all the time. I played The Battle of Wesnoth for about a year. In my free time(besides coding), I like taking some MOOC course about computer, game design, music and thinking. I also like watching Star Trek and enjoying Jazz, the great works of Horace Sliver make me feel relaxed.
1.2) State your preferred email address.
kevin.xgr [at] gmail.com
1.3) If you have chosen a nick for IRC and Wesnoth forums, what is it?
Kevin_Xi on IRC, FAKevin on forum.
1.4) Why do you want to participate in summer of code?
I think become part of something bigger than you(open source) is a kind of intrinsic motivation of human being and my heart is always vibrated to the great moment that a software come to life. I believe "Learning by Doing" and want to improve my skills, both on coding and communicating, by participate in a real-life project. The GSoC project is a good trigger for me to get my hands dirty.
1.5) What are you studying, subject, level and school?
I am a third year student on Software Engineering, Beihang University. The course I have finished are: Object-oriented programming with C++, Principles of Computer Organization and Architecture, Software Engineering, Database System Concepts, Network, Operating System, Compiler, System Analysis and Design and so on.
1.6) What country are you from, at what time are you most likely to be able to join IRC?
China. 8:30~10:00am, 1:30~12:00pm UTC+8.
1.7) Do you have other commitments for the summer period ? Do you plan to take any vacations ? If yes, when.
I would like to take this as a full time job, so I don't arrange other things.
2) Experience
2.1) What programs/software have you worked on before?
Part of my individual project is available here: https://github.com/Kevin-Xi?tab=repositories. Many of them are tools for my daily life. For teamwork, the latest project I am working on is a Raspberry Pi based smart home system. I develop web server use Django on Raspberry Pi.
2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own)
Yes, I teamed up with my classmates on C++, C#, Java, Django project several times. We often follow agile development methods and use git to manage our 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?
No. I just know it this year from my RSS reader
2.4) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement.
No. But I want to get involved. Sometimes I modify Linux kernel and re-compile it to learn it.
2.5) Gaming experience - Are you a gamer?
Yes. I play a lot, enjoy it and feel there are many things to learn from it, so I taked gamification course at Coursera. I do well in class and get a 10 out of 10 in a recently design work.
2.5.1) What type of gamer are you?
According to the Bartle Player Type Model, I am an archiver who like complete all levels and explorer who like finding out all possibilities in game.
2.5.2) What type of games?
Role-playing, Alternate reality, Educational, Puzzles, Strategy.
2.5.3) What type of opponents do you prefer?
Clever and polite. The most important is I can learn from my opponents.
2.5.4) Are you more interested in story or gameplay?
It depends on the type of game. I like fantasy background in RPG, gameplay in puzzles.
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 played it for about 1 year. I played all official campaigns and like to be a observer of online battles.
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 repository (during the evaluation period or earlier) please state so.
No. But I forked wesnoth on github and write a toy AI recently.
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.
There are four kinds of abilities one should develop when learning languages: Listening, Speaking, Reading and Writing. For listening, I am able to understand MOOC class videos without subtitles. For Speaking, although I do not have so much chances to talk directly to a native speaker, I sometimes practice my speaking skills by read after some English podcast online. For Reading, I choose origin English version textbook and read technical papers for information I want. For Writing, I write programming log as diary in English.
3.2) What spoken languages are you fluent in?
Chinese, 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.
Yes, I am a rational and friendly person.
3.4) Do you give constructive advice?
Yes. Sometimes I also give simple ideas to begin brainstorm among team members.
3.5) Do you receive advice well?
I have a systematic approach to take advice and learn from it .
3.6) Are you good at sorting useful criticisms from useless ones?
I think this depend how deep I understand the system. For wesnoth, since I don't familiar now, I wouldn't say I can. But I will try to ask developers and get familiar on it.
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
As a Software Engineering student, I consider both. But the way I like most is develop a prototype(that allow you to test your idea and fail quickly if it don't work) and test it.
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?
Yes, I choose "Improve AI by implementing global attack/retreat decision". I want to concentrate on figuring out in what situation the AI should change its strategy, in a quantifiable way with the help of fuzzy logic(to be efficient, economic) and other mathematical principles.
4.2) If you have invented your own project, please describe the project and the scope.
No.
4.3) Why did you choose this project?
I like AI since I was a freshman, I have some experiences on AI and got a 100 out of 100 in my Machine Learning course on MOOC. Since AI of wesnoth should include strategy analysis on terrain, time, arms, special abilities of units and many other aspects, I read the famous ancient Chinese book The Art of War by Sun Tzu since I was young, so I like and good at analysing these elements.
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".
Time | Tasks |
---|---|
Week 1 |
|
Week 2 |
|
Week 3 |
|
Week 4 |
|
Week 5 |
|
4.5) Include as much technical detail about your implementation as you can
This will be updated later.
4.6) What do you expect to gain from this project?
Familiar with the workflow of an open source community and keep working as a part of community. Improve my skill on programming and communication. The joy of accomplishment of the project.
4.7) What would make you stay in the Wesnoth community after the conclusion of SOC?
Creative, smart and friendly people in the community. Working as a part of something bigger than me.
5) Practical considerations
5.1) Are you familiar with any of the following tools or languages?
- Git (used for all commits)
- I manage almost all of my code, either individual or team work, on git
- C++ (language used for all the normal source code)
- I feel comfortable with the basic and the advanced features of C++, and code a lot.
- STL, Boost, Sdl (C++ libraries used by Wesnoth)
- I use STL, but don't familiar with Boost and Sdl
- Python (optional, mainly used for tools)
- Python is my daily life tool. I catch podcast and process text file with it. And I use Django to set up my web server.
- build environments (eg cmake/scons)
- I use g++ and make
- WML (the wesnoth specific scenario language)
- It "make coding accessible"
- Lua (used in combination with WML to create scenarios)
- No, I don't have experience on Lua. But I can be a fast learner with the experience of C++, python, Common Lisp, Java and so on.
5.2) Which tools do you normally use for development? Why do you use them? Vim, g++, gdb, make, git. Because these tools are build-in and powerful, and I can learn and modify them since open source. I will use IDE for some big project.
5.3) What programming languages are you fluent in?
C++, Java, Python, basic part of Common Lisp
5.4) Would you mind talking with your mentor on telephone / internet phone? Not at all, I will send my phone number to my mentor if I am accepted.