SummerOfCodeProposal 2011 LuaAI Afan

From The Battle for Wesnoth Wiki

This page is related to Summer of Code 2011
See the list of Summer of Code 2011 Ideas

This is a Summer of Code 2011 student page
Project: SoC_Ideas_LuaAI_2011



Afan - LuaAI

My idea is to improve the AI by allowing to to have more context of what is going on in each game. This means giving both the AI, and users knowledge in how good a move is, show suggested moves. To implement this, I plan to create an influence map for each AI player which will calculate roughly how strong each unit on the field is. Based off this the influence map will be able to tell the AI roughly how safe or unsafe a tile is.



SoC Application

SoC Application


1) Basics

1.1) Write a small introduction to yourself


I'm currently 19 years old and am a freshman in college. I haven't taken many programming classes but I have been programming for around on and off for several years and started to get more into programming in the last few years.

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?

As I've self taught myself pretty much everything I know in programming I'd like to see how much I actually know and what I can do to improve my programming skills. I also haven't done a program "properly" as in creating a design document and planning how to do code instead of just programming.

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

I'm studying computer science, but I am taking my general classes right now, and I am a freshman in college.

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

I'm currently in the United States, central time zone and can be on IRC from the evening to around 1 or two am.

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

I do not have any plans over the summer.

2) Experience

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

I've worked only a little with the HL2 engine and some unreal script.

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

I worked a few months for two small HL2 mods.

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 will be my first time in the Google Summer of Code.

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


2.5) Gaming experience - Are you a gamer?

Yes, I've been gaming for a long time.

2.5.1) What type of gamer are you?

I like to play a few games and get good at them, but unless there is a ladder or something I don't usually try to metagame and play for fun.

2.5.2) What type of games?

RTS, FPS, simulations mostly, but I've played a lot of different types of games and it would be hard to list all the genre's.

2.5.3) What type of opponents do you prefer?

I mostly like people who just play the game and who don't exploit the game or talk trash and the like.

2.5.4) Are you more interested in story or game play?

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've played a Wesnoth for a few months, I mostly played a little of the campaign and some multiplayer with friends. I would lean more towards single player than multiplayer.

We do not plan to favor Wesnoth players as such, but some particular projects require a good feeling for the game which is hard to get without having played intensively.

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.

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.

My native language is English so I would say I'm pretty fluent with it.

3.2) What spoken languages are you fluent in?

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

I would say I'm pretty good with talking with other players, and I've participated on a few game forums and I know how bad comments can get.

3.4) Do you give constructive advice?

I think I give good advice, I like to keep my advice small to keep the person doing what they want instead doing exactly what I said.

3.5) Do you receive advice well?

I believe that I receive advice well, as I usually think about what other people are telling me to do instead of dismissing it entirely.

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

I think I would be able to distinguish between useful and useless criticisms as throughout game communities people are always making suggestions/criticisms and you can tell which ones are blatantly bad and which ones should be actually considered.

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 like to quickly think of what I would need to complete a task and create a quick skeleton of the code and as time goes on add more features to the code and if needed, to delete entire sections of code.

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 selected the Lua AI Improvement project. I want to focus on allowing the AI to be more customizable, and in effect make the single player better and the AI tougher.

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

4.3) Why did you choose this project?

I choose this project because I am interested in creating AI, and I have some experience with binding c++ to Lua.

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 core features will be implemented by June 22ed, and the extra features will be implemented by July 25th.

Core Features.

Calculate influence Calculate the influence on each node simply based on the strength of each unit. Each node will decay over time until it finally reaches zero.
Unit strength heuristic In order for the map to work the game will need to know approximately how powerful each unit is.

Extra Features.

Calculate influenc Add the terrain into the map. This means if a huge mountain is between units, their influence shouldn't go over the mountains. If sight is reduced the units influence should be lowered as well.
Unit strength heuristic The influence map should consider units that are weak to nearby enemy units and reduce their influence.

Add Lua Hooks May 25th I will be simply looking at the AI source code, specifically the Lua classes, and finding all the AI functions that should be added to Lua.
Add Lua Hooks June 1st I don't plan for adding the AI functions to Lua to be very difficult as I already have some experience doing this.
Rough sketch/demo of Influence map June 22ed This will be a small "demo" of code that will be hooked up to the game. It won't have everything in the class yet but the main features should inside.
Flesh out - Milestone July 13th The main features and functions of the class should be set in stone, but the code can still be subject to change. Extra features should be added to the influence map that will make it smarter in its evaluation. This will also be a milestone.
Finalize influence map. July 25th All of the major work should be completed by now, with only minor things left to be changed or tweaked.
Finish and final debugging - extra time - Milestone August 1st All functions will be set in stone, with only small improvements and debugging being done at this time. The map and its functions should be added to Lua by now. This time will also be used if I am unable to meet the previous deadlines.
Code scrubbing, last minute fixes August 22ed Making sure everything works, making small changes, and making the code more clean.

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

Creating the Lua bindings would be pretty straight forward and would involve wrapper functions. I would improve the AI by giving it an influence map. When the AI makes a decision it could check the influence table and perform actions in the area of the map with the least perceived enemy strength.

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

I expect to gain knowledge on binding C++ with Lua, improving my general programming skills, and programming in an actual project with a deadline.

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

I wouldn't mind staying in the Wesnoth community if I have a good experience as I am completing this project.

5) Practical considerations

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

  • Sub­­version (used for all commits) I've had to use S­­V­­N for some of the groups that I've been in and to keep source code up to date.
  • C++ (language used for all the normal source code) Yes, I've self taught myself C++ and created several projects with it.
  • STL, Boost, Sdl (C++ libraries used by Wesnoth) I know the STL well but I haven't used much other than containers. Limited, I've used one or two libraries from Boost in programs. I've used SDL before and know the general stuff well.
  • Python (optional, mainly used for tools) None.
  • build environments (eg cmake/scons) I haven't used anything like cmake or scons.
  • WML (the wesnoth specific scenario language) No.
  • Lua (used in combination with WML to create scenarios) Yes, I've used it for a small Gmod addon I was working on.

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

5.3) What programming languages are you fluent in?

C++ and Java.

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!

Yes, but I've left blank for the wiki.

Changed Timeline 4/9/11. Changed Description 4/9/11. Changed IRC time 4/9/11.

This page was last edited on 21 March 2013, at 01:37.