SoC2014 vorobeez AI

From The Battle for Wesnoth Wiki
Revision as of 07:04, 12 April 2014 by Vorobeez (talk | contribs) (4. Formation of action to achieve the goal.)


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


ATTENTION

This page is not finished yet

AI Global strategy

High-level discription

Contents

  • Definitions.
  • Useful links.
  • Main part.

Definitions

Following definitions will be used in the specification and project implementation.

Fact - simple statement. Can be of two types:

  • Compares resources of player with the resources of another players.
  • Tells about condition and resources of game.

For Instance:

  • “The first player has less villages than a second player”.
  • “The first player has less gold than a second player”.
  • “The first player has more archers than a second player”.
  • “Now day”.
  • “Free villages are available”.
  • etc.

Goal - a global decision about what actions we need to take in order to convert the highest number of negative facts in the positive.

Goals might be as follows:

  • “Need to capture the village...X”.
  • “Need to attack the point...X,Y”.
  • “Need to step back to the point...X,Y”.
  • “Need to move to the point...X,Y”.
  • “Need to recruit units of type...X”.
  • etc.

Useful links

To understand main part of the project you must understand some basics in probability theory. Some basic knowledge:

Probability theory

Event

Main part

In this section we have a description of the basic steps of the algorithm and a simple example explaining how the algorithm works.

1. Getting data.

We obtain data about present condition of the game. Such as:

  • Number of villages captured by the first side / second side /...
  • Number of free villages
  • Number of units in the first side / second side /...
  • Number of units of a certain type in the first side /second side /…
  • Amount of gold in the first side / second side /…
  • Time of day.
  • etc.

Expample

Suppose that we are playing for a first side and against us playing the second side. And suppose that we have such data:

Number of... First side Second side
villages 6 8
gold 40 56
fighters 2 5
archers 3 2
scouts 4 3
all units 9 10
Available 6 villages.
Now Day

2. Creating facts

We have received the needed data. Next step will be creating facts based on this data.

We have already seen an example of the facts, so let's get right to the example:

From the data we obtained the following facts:

  • "The first player has less villages than a second player"

  • "Free villages available"

  • "The first player has less gold than a second player"

  • "The first player has less fighters than a second player"

  • "The first player has more archers than a second player"

  • "The first player has more scouts than a second player"

  • "The first player has less units than a second player"

  • "Now day"

We give a graphical example in Figure:

wujmf5.jpg

For every facts we have corresponding color. For black points corresponds opposite facts for our derived facts.

3. Creating goal.

Next step will be creating goals from derived facts.

Suppose that for our set of facts corresponds just three goal:

  • “Need to capture the village...X”.

  • “Need to step back to the point...X,Y”.

  • “Need to recruit warriors".

Another one graphical example in Figure:

2kk1me.jpg

Again for every goal we have corresponding color.

We now turn to the choice of goals. We have 8 facts. Suppose that probability of each fact = 1/|number of derive facts|. Consequently in our case we have probability of each fact = 1/8. Based on that rule we compute probabilities for our goals:

“Need to capture the village...X” = 4/8 = 1/2.

“Need to step back to the point...X,Y” = 3/8.

“Need to recruit warriors" = 2/8 = 1/4.


And we get goal with highest probability: “Need to capture the village...X”.

4. Formation of action to achieve the goal.

After we choose the goal, we need to define actions that will help us to achieve the goal. What that’s means?

  • Determine the optimal number of turns (1-2 max)
  • Determine the exact coordinates for the purpose.
  • etc.

Example: We choose a target

Low-level discription

IRC

vorobeez



Questionnaire

1) Basics

1.1) Write a small introduction to yourself.

I'm Andrew Firsov, second-year student of Ivanovo State Power University.

1.2) State your preferred email address.

vorobeez@gmail.com

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

vorobeez

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

I have to take experience with open source projects, improve programming skills and fun.

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

I'm studying math(combinatorics, probability theory, mathematical analysis, linear algebra...), computer science(algorithms, data structures, cryptography, compilers, C++, Lua, some libraries: SDL, crypto++, STL, boost), and a bit of game theory

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

I study at Ivanovo, Russia (UTC+04:00), but throughout the summer months i will live in the Simferopol (Crimea,Ukraine) (UTC+02:00).

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

I want to travel to the Crimea on the weekends. That's all.

2) Experience

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

i created small projects for my needs and games to learn how works SDL and for realizing my own ideas.

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

No, i haven't

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 haven't

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, i'm not. But i love open source and use it every day.

2.5) Gaming experience - Are you a gamer?

I was a gamer. Now I sometimes play wesnoth and FTL. I like games in which we must think.

2.5.1) What type of gamer are you?

Hardcore gamer.

2.5.2) What type of games?

Strategies and little bit of indie-games.

2.5.3) What type of opponents do you prefer?

Real players with wide experience.

2.5.4) Are you more interested in story or gameplay?

I love deep and great stories in games. But in order to the gamers could have fun all components of the game should be worked out at high level

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'm playing Wesnoth for 1.5 years. I prefer SP. But sometimes play in MP with other players.

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.


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.

I'm good at written English. And i speak with English native speakers freely.

3.2) What spoken languages are you fluent in?

Russian (native), Ukrainian, 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.

3.4) Do you give constructive advice?

3.5) Do you receive advice well?

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

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


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?

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

4.3) Why did you choose this project?

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

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

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

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


5) Practical considerations

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

  • Git (used for all commits) I use basic functionality of git for my projects.
  • C++ (language used for all the normal source code) I good at C++
  • STL, Boost, Sdl (C++ libraries used by Wesnoth) I know STL, SDL 1.2 and a little SDL 2.0. And I learn boost, but not often use it. Also i'm fast learner
  • Python (optional, mainly used for tools) No
  • build environments (eg cmake/scons) basic knowledge and using
  • WML (the wesnoth specific scenario language) In theory, but i don't use in it practice
  • Lua (used in combination with WML to create scenarios) Yes

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

  • git and github to commits and verify version of my project.
  • gcc and make for compiling separate sources.
  • vim or sublime for coding.


5.3) What programming languages are you fluent in?

C/C++ and Lua.

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!