SoC2012 LineDefenceStrategy

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


Contents

Description

Nikolay Agafonov - Line Defence Strategy

The idea of this strategy is to stick together the troops and create the defencive line. All the units should be put on hexes where they would be on the defensive in most effective way. THere would be some kinds of AI's behaviour (full retreat, banking, passive attack etc.) depending on on game factors.

Main Idea

To make full defence mostly effective as it is (i mean just protection of area, not scouts' breakthrows during the enemy's attack and such things) it is neccessary to decrease the number of hexes from which any unit could be hitted. Because of zone of control factor the best way would be to make defencive line with units.

Line creation

All the units, which protect the area should find the best position for defence (for example, dwarves should search for hills/mountains, elves for forests etc.). In the case when units can be put in different positions with same avarege defence, te unit factor comes.

Line condition

First of all, the line should be created. Let make a definition of line: Line - the sequence of hexes on which the available units would make maximal summary zone of control with minimal attacked area. The attacked area would be defined depending on danger of unit wave. For example a lot of units are going to attack the AI's forces from north while a couple of scouts stand in south. So the defencive line would be directed to the groups of units by priorities: high priority would be given against the most dangerous wave, lesser priority - to the smaller group and so on. The hexes which satisfy this conditions would be marked as defencive line area.

Unit factor

Let's imagine the situation when some support unit (elfish shaman for example) and fight unit (orcish grunt for example) should divide hexes, one of which is bad for protecting for both of them and another is good for fighter and very good for support unit (lets take forest and sand as an example: grunt and shaman have 70% chanses to take a hit on sand while in the forest grunt has 50% and shaman has 30%). In such a case the defencive coefficients should be counted. The number of coefficients would be K = (n-1)!m! where n is number of units and m is number of avaible hexes which satisfy the line condition. Each coefficient would be equal the summary of multiplying of current units'hitponts and the persent of defense for each other on hexes where they can be put where. In simple example with 2 units - shaman (lets say with 30 hitpoints) and grunt (let it has 40 hitpoints) - and 2 hexes - sand and forest - coefficient q1 = 30*0.3 + 40*0.5 = 29; q2 = 40*0.3 + 30*0.7 = 33. So q2 > q1 which means that putting shaman to the forest and grunt on sand would be better than in reversal case.

AI's behaviour

This part has the lesser priority than pervous

Depending on the game situation AI would change it's behavior. For example, retreating to the leader or the keep (if the leader is far away from it) before the daytime if there is a real danger (superior opponent's forces near the AI's forces where the majority is chaotic but its daytime for example) from opponent. Another example is the passive attack, when attack is going with slow movement of all the defencive line. Such a tactic could be good with strong expensive units against opponents' weaker and cheaper troops - holding of the area with small group of units and collect the gold, 'cause decrease would be lesser than the opponent which should spend more money for upkeep of all the count of his weak units.

Conclusion

The idea of the defencive line let to achieve position game from AI's side. not agressive but grueling - the way how many serious players are playing

Working Plan/Timeline

this section is preliminary and can be easy changed

Priorities

Main priority:

  • Line creation
  • Implementing the defence strategy for line defence

High Priority:

  • Passive attack with using the line defence conception

Avarege Priority:

  • Banking strategy with using the line defence conception

Low Priority:

  • Counterstrike microtactics

Timeline

April - May: creation of preliminary mathematical models and conceptions, learning current AI mechanics, wesnothian lua functions.

21.05 - 01.06: Line creation implementation

02.06 - 04.06: Testing the line creation and fixing the bugs

05.06 - 15.06: Implementing the defence strategy

16.06 - 20.06: Testing the defence strategy and fixing the bugs

21.06 - 25.06: Creation the model of passive attack with using the line defence conception

25.06 - 05.07: Implementation of passive attack with using the line defence conception

05.07 - 15.07: Testing the passive attack strategy and fixing the bugs

16.07 - 20.07: Creation the model of banking strategy with using the line defence conception

21.07 - 01.08: Implementation of banking strategy with using the line defence conception

02.08 - 08.08: Testing the banking strategyy and fixing the bugs

09.08 - 16.08: Creation and Implementation of the counterstrike microtactics

last days: testing the microtactics and fixing the bugs

Backup goals

if something will be going wrong with the main idea i propose to implemnent next things:

IRC

nagafono

SoC Application

Submitted to google

Questionnaire

Basics

Write a small introduction to yourself.

My name is Nikolay Agafonov, I am a 3rd-year-student and study on Departament of Computer Science, Math faculty. Relatively to Wesnoth: I'm well-experienced player which is often play serious ladder games (my current position is between 30 and 40 places)


State your preferred email address.

nagafono (at) gmail (dot) com

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

nagafono


Why do you want to participate in summer of code?

Because I want to implement the stuff which would be really useful for me and, I hope, for all the players too. Also a lot of imagination and some math skills should be used here and that's the things i like to do. And Google's stimulation of such a work makes summer of code the main priority thing on summer for me.


What are you studying, subject, level and school?

I'm studying IT and math in Petrozavodsk State University (Russia): 3rd grade, Departament of computer Science. Before that, almost 2 years my Departament was Applied Mathematics.


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

Russian Federation 16:00-00:00 GTM.


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

I'm planning to make 1-week vacation on the last week of June, nothing more.


Experience

What programs/software have you worked on before?

Languages/frameworks (good knowledge): C++, Qt framework

Languages/frameworks (avarege knowledge/rare usage): C, Python (+Django framework), PHP

Languages/frameworks (low knowledge/basics): C#, Java

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

Yes I am (4 projects experience). Prefer to use git but have knowledge about S­­V­­N and CVS also.


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?

Nope, didnt know about it before


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

I was working on next projects: - Transfomail (SMTP client for mobile platforms) - my own project. Long time ago took 4th place in local Nokia apps competition but was stopped long time ago. - QMF-vkontakte - messaging plug-in for a big student (separated from university) project "MySocials" (crossplatform client of popular social networks for Maemo 5/MeeGo platform) provided by Nokia - teamwork here, i was a simple coder with some easy design tasks. - Mobile Battery Predictor - charge predictor (with graphs and other cool stuff) for Maemo 5/MeeGo. Here I was main designer and coder. - VochMee - TV-shows program for mobile devices. On hold for now. Here I was main designer and coder also.


Gaming experience - Are you a gamer?

Yep, prefer to playing ladder (my elo is 1900+ for current moment) and wanna hope that i'm not the bad one


What type of gamer are you?

Grand strategy gamer.


What type of games?

Wesnoth, Civilization 5, Europa Universalis 3, Crusader Kings 2 - the chess of XXI century. some RPG when my brain wants to take a rest.


What type of opponents do you prefer?

Wesnoth: In serious ladder games - the players with 1700+ elo. In all other the cases i dont really care - they just should not leave the game too early. All other the games: I prefer to play offline.


Are you more interested in story or gameplay?

Relatively Wesnoth gameplay is on the main place because of its uniqueness.


Have you played Wesnoth? If so, tell us roughly for how long and whether you lean towards single player or multiplayer.

Singleplayer experience is about 5 years when multiplayer about 1-2.


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.

work-in-progress. I'm writing new candidate action for leader control - healing.Current state is: cleaning of errors and bugs

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.

Seems like this questionnaire should already give an answer :) I think my level is avarege: less skils in grammar, more - in talks


What spoken languages are you fluent in?

Russian and English. Also i understand almost all the slavs' languages (ukrainian, polish etc.)


Are you good at interacting with other players? Our developer community is friendly, but the player community can be a bit rough.

Unlike the RNG, I am. Real life people from my country are much more rougher so wesnothian players are friendly enough for me anyway.


Do you give constructive advice?

If there is a need and the guy which this advices should be responsed is want to hear it


Do you receive advice well?

Depends on problem. In professional meaning - only from specialists or people whose really know something about this area. In all other the cases - again, depends on the problem and person.


Are you good at sorting useful criticisms from useless ones?

Absolutely yes


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

Well, I want to see the mentor in manager's role. So when i would have the design plan, it should be approved by, same thing with all other the stages


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?

In this application - yes. AI's total defence strategy. I want to concentrate on "passive-playing" tactics.


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

Lets call it "Line Defence Strategy". its relating to AI's strategies


Why did you choose this project?

'cause i have a need in this :) and i'm sure that other players also have. Also, interesting task for brainwork - some math here.


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

As my task is not designed yet there is no reason to plan something for "active coding" time. When everything would be designed by, there would be priorities and timeline for each priority.


Include as much technical detail about your implementation as you can

C++ as a language, what can i add else? The main work would go on logics, not on the technical features


What do you expect to gain from this project?

Everything what it provides: knowledge, experience, fun and same stuff. Also, my idea would be useful for me so i'm going to just improve Wesnoth in the i want to see. And sure, all the promotions like diploma and all oher the things that Google donates also would be a nice addition :)


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

I'm going to working serioulsy on unofficial wesnoth ladder, so it will be high priority. dont know about official Wesnoth - its all depend on time.


Practical considerations

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

Sub­­version (used for all commits)

Yep, i know the basics, but use git.


C++ (language used for all the normal source code)

Absolutely yes


STL, Boost, Sdl (C++ libraries used by Wesnoth)

SDL a bit


Python (optional, mainly used for tools)

There is some experience but mostly for web apps


build environments (eg cmake/scons)

Yep


WML (the wesnoth specific scenario language)

Not really


Lua (used in combination with WML to create scenarios)

Nope


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

Qt Creator because of substitution :)


What programming languages are you fluent in?

copy of 2.1:

Languages/frameworks (good knowledge): C++, Qt framework

Languages/frameworks (avarege knowledge/rare usage): C, Python (+Django framework), PHP

Languages/frameworks (low knowledge/basics): C#, Java

and all this html/css stuff also well known

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.

why not, my skype is on!

This page was last edited on 20 March 2013, at 23:31.