SummerOfCodeProposal Darkas

From The Battle for Wesnoth Wiki


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



This is a Summer of Code 2010 student page
Project: SoC Ideas Lua AI


Description

Darkas - Extend Wesnoth Lua AI Support and write a "defend" AI

The first part of the proposal is described at SoC_Ideas_Lua_AI. So if the AI is exposed to lua and works, the AI should get 2 more features: defend effectively (shield wounded units, line up to get less attacks if there are more enemies, etc.), and decide when it's time to defend (this is per unit, so if there's a group of units that gets attacked, they'll be defenders now, but other unit may remain attacker). If that's done, the AI should also be able to do some missions better, if they should protect something for example, then they'll defend this special place or unit, instead of attacking the others and hoping they won't get there.

Defence Strategies

  • Line units with highest resistances, most hp and best field modifiers and get the rather weak units/healers to the back
  • Flee to have your units standing on villages/fields where they can fight better
  • In case you have units that are close to leveling up, but not much hp, try to get them killing enemies
  • If you're too weak, flee even at the cost you loose villages (if not, try to defend them)
  • If there's a unit that doesn't have a big hp maximum, but is at good health, use a formation so that it can just be attacked by one enemy
  • Consider time of day in cases when its obvious, like drakes vs undead, neutrals vs loyalists, and attack or retreat accordingly.
  • When retreating because of bad ToD, keep just 1 hex out of the opponents best moves so when ToD changes the AI can react right away.
  • Line up at a place where the AI got high defences, but their enemys is low. This might be a river for example
  • If the enemy has no skirmishers (or maybe only 1 or 2 weak ones?), you can leave a gap, when you need a unit at some other place. In the best case, this gap is one with a low defence for your units.
  • In some formations, you might be able to place healers in a way they heal more than just 2 units, maybe 3 or 4. Consider that too (of course, if they all have high HP and others are very low, it's better to heal these)
  • If there's a village that you want to defend, place a healer on that house and the other units around that healer
  • For defending a hexagon, use rather cheap units, and if it's getting critical, move the leader to that hexagon (after recruiting as much as possible)
  • When defending a unit, use 3 cheap units surrounding that one, so it's hard to attack it (except for skirmishers)
  • Try slowing the strongest units when getting attacked (start with the strongest one, and if it's already slowed down, the next weaker one and so on)
  • If the AI wants to protect a unit or a special place, they'll use the same tactics, but they always keep close to that place, so they don't flee into it and they won't walk towards their enemies

Thanks to jaimeastorga2000 and batoonike from the forums (http://forums.wesnoth.org/viewtopic.php?f=3&t=29347), who helped me a lot with these strategies!

IRC

Darkas

SoC Application

Extend Wesnoth Lua AI Support and write a "defend" AI

Questionnaire

1) Basics

1.1) Write a small introduction to yourself.

My name is Andre Knispel, currently 17, but I will be 18 soon enough.

1.2) State your preferred email address.

andre.knispel@gmx.de

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

Darkas

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

I want to improve my skills in Game Development, which I only collected in small projects yet.

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

That's a bit complicated ;) Mainly, I'm pupil, at the Roentgen Gymnasium Wuerzburg, and will finish school in summer next year, but I'm also in an "early university education" program, what means I'm studying Math and Computer Science to bachelor degree in the 2nd year (currently between 2./3. semester).

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

I'm from Germany. The time I'll be online in IRC depends heavily on the day, but mostly in the evening/night (17:00 - 24:00, GMT + 1).

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

No plans yet, and chances are high that GSOC will be the only one.


2) Experience

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

I've worked on several learning and algorithmic programs, but also on a free game development environment, the Open Game Studio, which is still in an early state.

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

Yes, the team of the Open Game Studio which I leaded.

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, this is my first try.

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

The Open Game Studio. I started the project and leaded the development for a long time now. The Open Game Studio wants to be a engine that can possibly run any kind of game, and a game studio that can be used for creating these games.

2.5) Gaming experience - Are you a gamer?

2.5.1) What type of gamer are you?

I'm not playing much, but if there's a good game, I might play it all day long, and maybe the next day and then have a pause for a week or so.

2.5.2) What type of games?

I like stategic games, but also adeventures and good multiplayer games (of any genre).

2.5.3) What type of opponents do you prefer?

That depends heavily on the game. I really like beating a strong AI opponent, but for short games I usually prefer humans.

2.5.4) Are you more interested in story or gameplay?

Both. In multiplayer games, gameplay is way more important, but if I play alone, story is usually more important. But there are also games I like playing alone where the gameplay is so good, that story is completely unrelevant sometimes (Wesnoth and Fire Emblem for example).

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 played it for a month now, more in single player mode (in multiplayer, I always beat my friends and loose online).

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 already wrote 2 patches: https://gna.org/patch/?1558 and https://gna.org/patch/?1559 and I'll get commit access shortly.


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 do understand most things, but I think sometimes I use some strange expressions.

3.2) What spoken languages are you fluent in?

English, German

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

That's no problem, I'm familiar with that.

3.4) Do you give constructive advice?

Yes, I give my best.

3.5) Do you receive advice well?

Yes.

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

I think so.

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 discuss, because it often gave the better results in shorter time in the past.


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'm interested in improving the Lua AI Support, by exposing the already existing C++ functions to lua. Then, I want to improve the AI to defend units and places more effectively, and also if they have a group of units that gets attacked, they should be able to do better than now. If that's finished I want to create a campaign that is more than just: defeat all enemies in 20 turns. Something like: protect character X (not necessarily the main character) for 10 turns, where the enemy just tries to kill you, conquer the castle and defend it 5 turns, where the enemy first defends, and if you got the castle, it attacks, and also something like: kill a specific unit of the enemy, where the enemy now tries to defend that unit.

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

No own project.

4.3) Why did you choose this project?

I want to learn things about AI, and I like more tactical scenarios very much.

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

In the first coding period (24. may - 16. july), I hope to complete the exposing of the exposing of the functions to lua, I think that should be maybe 1/3 of the overall work. This is the part where I'll code less, because of school + university (that's why I'll do the smaller part there). I'll also have exams at the end of that time (but I don't know when exactly yet). After that period, school and university is over, so I can concentrate fully on coding (and I'll have a lot more of time). That means I'll do the rest of the project (AI improvements) in that time.

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

The first part of the project will be exposing all the AI functions that are already written, to lua, so AI can be written better in lua. Then, I'll add a flag to AI units, so they can be 'attacker' or 'defender', and at the beginning of each turn, there'll be a check if it would be good to change that flag. This check might also be done in relation to the aggression, so if aggression is higher, it's harder to get flagged as 'defender'. The 'attackers' do now proceed with their normal stuff, but the defenders will use some other candidate actions, that do actually defend. How these candidate actions will act, is described at the top of the page.

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

I hope to get experience in AI programming for the Open Game Studio, but I also want to get connections to a bigger project, and learn how working there is like.

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

The very nice community and the great game, that is worth submitting patches.


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/autotools/scons)
  • WML (the wesnoth specific scenario language)
  • Lua (used in combination with WML to create scenarios)

I used Sub­­version for a long time in the past. My normal programming is almost always in C++, and I'm familiar with STL and SDL, not with Boost yet. I don't have much experience with Python, I just once changed a few little scripts. I've used autotools, but not cmake or scons yet. Also no WML. But I'm very familiar with Lua, both the language and the C(++) bindings.

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

I write most of my sources with kate, but maybe I'll move to kdevelop. kate has all functionality I need, and it's a great and fast editor, kdevelop might just be a little better with syntax highlighting and other, C++ specific things. I compile my sources using make/autotools, because you can use them on almost any linux system (but I discovered cmake through Wesnoth, and it's also worth a try).

5.3) What programming languages are you fluent in?

C/C++, C#, Java, and surely some others I forgot because of my little knowledge of them.

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!

Feel free to contact me by phone ;)

This page was last edited on 21 March 2013, at 00:23.