Soc2012 Borgrumm Defensive AI

From The Battle for Wesnoth Wiki
Revision as of 23:32, 20 March 2013 by Esr (talk | contribs) (Hide historical instance of "SVN" from mediawiki search to avoid false positives.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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


Christopher Conway - Defensive AI

My goal is to develop an AI which is capable of “total defense” behavior, as opposed to the current aggressive AI. It would allow for the AI to function in scenarios like controlled retreats, unit escort, or holding a given area while minimizing unit loss.

Proposal Details

My proposal is to develop an AI which is capable of defensive scenarios. The AI would have different behavior for scenarios such as defending an area, escorting a unit to a given goal, or simply a more defensive version of the current regular AI. Some common behavior in any defensive AI would be to:

  • Withdraw wounded units out of harms way, preferably to a place where they can be healed.
  • Form defensive lines to minimize the threat to more fragile units
  • Alter behavior to take advantage of the map and terrain
  • Minimize unit loss, and prioritize the preservation of more experienced/expensive units



SoC Application

Submitted to google


1) Basics

1.1) Write a small introduction to yourself.

My name is Christopher Conway. I'm a Computer Science major, and I'm currently in my third year of study at the University of Arizona.

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?

I'm looking to get experience with professional work that relates to my area of education. I'm also especially interested in work that involves gaming, since that's where I want to end up after I graduate, and I’ve enjoyed the work on AIs I’ve done in the past.

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

I'm studying Computer Science at the University of Arizona. I'm currently in my 3rd year of study, and I'm on track to graduate in May 2013.

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

I'm from the United States, in Arizona. My daily schedule for the summer isn't nailed down yet, but 5:00 PM - 1:00 AM GMT (10 AM – 6 PM my time) is probably when I'd be most active.

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

I don't currently have any other summer commitments, and have no vacation plans this summer.

2) Experience

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

I haven't done any professional programming yet, but I've done projects in Java, C, Ruby, Haskell, and Prolog, as well as some scripting. Some of the school projects I've worked on include:

  • Multiple games in Java, including a text-based MUD, a simplified version of Risk, and a strategy game with gameplay inspired by the Megaman: Battle Network series, all of which included AI work
  • Complex data structures in Java, such as AVL and 2-3-4 trees, and others in C, such as a 3-D orthogonal list.
  • Some basic AI work in C
  • Experience with threads in java
  • Some work on an OS in C
  • A plagiarism checker in Haskell, as well as other mathematical functions
  • Basic database work in Prolog, including some linguistics-based work
  • A social networking-inspired database program in Ruby

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

Yes; some of my work in Haskell, Ruby, and Prolog was done in pairs. My OS work has also been in pairs, and the MUD in Java was done in a group of four.

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?

This is my first time participating in GSoC.

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

I am not currently involved in any.

2.5) Gaming experience - Are you a gamer?


2.5.1) What type of gamer are you?

I’m generally a single-player gamer, though I have played some MMOs and competitive games like Starcraft 2 and League of Legends.

2.5.2) What type of games?

My favorite games are RPGs, followed closely by strategy games. I prefer games where I have to think in order to win, as opposed to more twitch-based games like most FPSs. My favorite games are Planescape Torment, Baldur’s Gate 2, and older strategy games like Final Fantasy Tactics and the Tactics Ogre series. Some more recent games I’ve liked are The Witcher 2 and just about any RPG to come out of Atlus.

2.5.3) What type of opponents do you prefer?

I generally prefer challenging opponents. Games get boring too fast if I’m always winning.

2.5.4) Are you more interested in story or gameplay?

I’m interested in both, though I generally place more emphasis on story. I’ll play through poor gameplay if the story grips me, but I’m much less forgiving when it comes to a boring story or characters.

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 first found Battle for Wesnoth last summer, while looking for interesting games to play on IndieDB; I played the tutorial and a couple of the campaigns, and enjoyed it a lot, until school started up again and I got distracted by schoolwork and other games. I recently started playing it again. I lean strongly towards the single player, and have yet to try the multiplayer, though that’s something I’d like to devote some time towards once the semester ends.

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.

I have not contributed any patches to Wesnoth.

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 am a native English speaker, and I’m completely fluent in written English.

3.2) What spoken languages are you fluent in?

Just English. I know some Spanish, enough to generally get the gist of what people are saying, but not enough to communicate effectively.

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

I’m generally good at interacting with other players, including in competitive communities like Starcraft or League of Legends.

3.4) Do you give constructive advice?

Yes, whenever I feel I have something to contribute.

3.5) Do you receive advice well?

Yes. I like getting feedback on ways I can improve my work, and usually get something helpful out of any advice, even if I don’t feel that the advice itself is specifically helpful.

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

To my knowledge, yes. I generally consider criticism in the context of what I’m trying to achieve, and decide whether or not it’ll improve my work before trying to follow 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 wants.

I prefer to get a general guideline of what I’m going to do in my head, start coding early, and make changes as I go and as the project demands. I’m not afraid to scrap my work if it doesn’t turn out to work quite right.

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?

I chose the Defensive AI project from the list.

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

I haven’t.

4.3) Why did you choose this project?

I’m interested in going into gaming on a professional level. In addition, in my work on games in school, I’ve found that the parts I enjoy the most are working on GUIs and AI design. This project seems like the kind of thing that’s not only good work experience, but something that I’d genuinely enjoy working on.

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

The first thing I would do is try to implement some of the simpler defensive tactics, like withdrawing units for healing and using stronger units to cover for more vulnerable ones like healers, as well as researching other effective defensive strategies in the community. I would try to have a functional defensive AI ready by the mid-term evaluations in July, though it probably wouldn’t be good enough for a final release at this point.

In the remaining weeks, I’d test the AI extensively, and try to improve and refine its tactics as much as possible. This is also when I would try to implement more reactionary tactics, like keeping as far away from the trees as possible when fighting elves, or isolating and focusing down enemy units more likely to pose a threat of breaking through the AI’s defenses, or other tactics that depend on what the opponent is using over more concrete things like the terrain.

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

Some of the initial goals of the AI would be to:

  • Pull damaged units away from possible enemy attacks, preferably to areas where they can be healed.
  • Group units in such a way that more fragile units and support units have as few avenues of enemy attack as possible
  • Alter behavior based on the map; for instance, elves move through trees wherever possible, orcs behave more aggressively at night, etc.
  • Alter behavior based on enemy playstyle; for instance, if the player has more mounted units, try to engage them in forests; pick off lone units; etc.
  • Different types of AI behaviors depending on the scenario: for instance, a defensive retreat with the goal to get a certain unit to a set destination would have a different behavior than a scenario in which a certain area needs to be defended.

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

I expect to gain a better understanding of how AIs work in games, as well as some good professional experience.

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

From what I’ve played, Wesnoth seems like it would be a fun game to continue working on even without SOC. After AI work, I think I’d be very interested in designing a campaign.

5) Practical considerations

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

I am somewhat familiar with both C++ and Python, though I haven’t used either in any large projects. I’m not familiar with any of the other tools or languages.

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

I use Eclipse for both Java and C, mainly because I prefer the interface to other tools I’ve tried.

5.3) What programming languages are you fluent in?

Java, C, Haskell, Prolog, Ruby

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!

I have no problem talking over the phone or over Skype, or any other chat software.

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