SoC2012 Multiple CTK Calculations

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


Angel Guevara - Whiteboard: Multiple Chance-to-kill calculations

Using the whiteboard feature a user can set several units to attack a single enemy unit but currently there is no way for the game to show you what are the chances to kill that enemy unit after all the attacks. The idea is to create a 'planned attack' dialog which would show the chance-to-kill (and, potentially, allow to reorder the attacks from within the dialog then recalculate the chance to kill taking into account wesnoth specials and abilities (like slow, illuminate and leadership).

Mathematic background

I am a math undergraduate who have participated in several international contests with good results so I can easily calculate statistic during game without the help of the computer (which will be really useful during the debug part of the project). I also have a very good understanding of statistics and can create code about mathematics really easily and find bugs on the algorithms.

Wesnoth Background

I have played wesnoth for at least 4 years (since wesnoth 1.4) so I undestand the implications of the game and all the list of abilities, traits, weapon specials and alike that will allow me to implement it to the code more easily.

Also as an avid player I can test this with the wesnoth team in campaigns, multiplayer and as observer.



SoC Application

Submitted to google


1) Basics

1.1) Write a small introduction to yourself.

My name is Angel Guevara I am a programmer and a fan of Wesnoth which is my favourite game.

1.2) State your preferred email address.

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


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

This is a very good opportunity to kill several birds with one shoot. I will be able to help one of my favourite games, I hope to gain some job recognition and a way to know more people on this field of development.

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

I study mathematics at UNAM México and have 5 years experience in programming.

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

México 21:00 to 3:00 GTM.

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

I have a part time job only.

2) Experience

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

Several programming languages like php, c++, java, javascript, bash, html, css, sql and frameworks like drupal, raintpl, bootstraps, lesscss, mPDF, eclipse, jQuery, extJS.

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

Yes I am used to work in teams mostly using S­­V­­N.

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?


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

MathCarousel is a project I made myself.

2.5) Gaming experience - Are you a gamer?

Yes a very enthusiastic gamer.

2.5.1) What type of gamer are you?

Mostly strategy and combat old school.

2.5.2) What type of games?

Titles like Age of Empires, FreeCivilizations, Wesnoth, King of Fighters, Fatal Fury, Warmux.

2.5.3) What type of opponents do you prefer?

Educated and calculators who work on strategy rather than impulse.

2.5.4) Are you more interested in story or gameplay?

Both but a good story will keep me hooked like it did with King of Fighters and Wesnoth.

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

Yes during at least 4 years. I use both single player and multiplayer spending similar amounts of time on each.

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.

Mostly helping translation to spanish helping Espreon and ShadowMaster.

A patch to start supporting the [recall_cost] key

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.

Very fluent with good grammar better than most natives.

3.2) What spoken languages are you fluent in?

English and spanish.

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. I have used the MP server for several years.

3.4) Do you give constructive advice?

Mostly I suppose I do.

3.5) Do you receive advice well?

Yes depending on the education of the adviser.

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

I rather not start coding until I have a general idea of the final product and the best ways to achieve 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?


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

4.3) Why did you choose this project?

Because I am good at math and this seamed like a perfect fit to me. I can make those calculations easily but I think its a good idea to let the game to make them.

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

Depends if I can redefine the current attack dialog or create a layer upon it.

About the backend: The calculations are already there so it won't be necessary to do much work except to handle the dialog and allow user do things like letting a unit change the attacks it will use, change the order of the attackers.

But for that its necessary to first get to know how the dialog will be.

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

Will work on the c++ code of the dashboard. Getting the statistics from the AI calculator and showing them using the current GUI. I think the best would be to re arrange the current dialog like this descargar-el-apk-juego-The-Battle-for-Wesnoth-v1.8.6.1-Android.jpg here the attacker, weapons and defenders are on the same row. The multi attacker layout would be a grid having one row for each attacker and the columns would be Options, attacker, weapons, defender.

The options will be an up and down arrow to change the order of the attacker and a damage calculation button.

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

Laboral recognition, experience and helping this opensource project.

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

I will stay and have been staying for a long while.

5) Practical considerations

5.1) Are you familiar with any of the following tools or languages? Sub­­version (used for all commits)


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


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


Python (optional, mainly used for tools)


build environments (eg cmake/scons)


WML (the wesnoth specific scenario language)

Yes, very much.

Lua (used in combination with WML to create scenarios)


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

Vim. Its simple, quick and allows me to modify anything I want.

5.3) What programming languages are you fluent in?

php, javascript, sql, html, css and c++.

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.

Yes, will provide the number when necessary.

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