User:MGoods

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



Description

Mark Goodenough - Improvements to the Lua AI

I propose to first extend the capabilities of the current system for using Lua scripts to dictate AI behaviour, which is the main part of what the Wesnoth team have said they want from this project. After that I intend to program some specific behaviours that scenario designers might find useful, like 'focus on this unit' for situations where the players looses if a unit dies. Finally I intend to try to improve on the current Wesnoth AI creating an AI that performs better against human opponents, hopefully by joining the Wesnoth project and working with Crab on the AI. This last goal is the hardest part, as I've never written an AI before although our course at uni does cover the theory side of possible AI implementations, and I may not succeed.

IRC

MGoods,MGoods|RangerM

SoC Application

SoC Application

Questionnaire

Basics

1.1) My name is Mark Goodenough. About four years ago I worked on Wesnoth as a UMC creator and a minor art contributor. I joined the community when I picked up some WML and coded up some scenarios, just to see if I could, and I started creating art mainly because I needed art assets for my campaign, but couldn't find anyone to make them (artists being much much rarer than aspiring campaign developers). Since then I left the project because I simply didn't have enough time to work on it, especially as creating art takes me... well a long time and aside from WML and failing my first attempt at Java I had no coding experience, and I had to focus on getting into the best uni that I could.
1.2) mg545@cam.ac.uk
1.3) My IRC nick is MGoods or MGoods|RangerM, my forum nick is the one I created four years ago, RangerM
1.4) Wesnoth was my first open source project, my first introduction to any form of coding (although at the time I had attempted to code in Java, it hadn't really clicked, WML was easier), I'd like to work on it because I remember it as being a good, welcoming community, and I'd like to give something back to my first open source project. I also quite enjoyed playing Wesnoth, and if I had time right now I expect that I still would (It's been about a year since I played). Aside from that Wesnoth is also one of the most successful open source game projects that I know of, and I plan on going into games creation as my job in the future, so I feel that this will give me a feel for being in games development that I don't currently have.
1.5) I study Computer Science at Cambridge University, I'm about to take my second year exams so in the summer I will be between the second and third years.
1.6) England, most of the time I will be on IRC between 11 AM and 8 PM GMT, although I have been known to keep odd hours when I have no time commitments but I do have something to work on.
1.7) No Vacations, and I have no other commitments over the summer period.

Experience

2.1) I have written a few programs to perform various small tasks (for example once when I tried to make time for wesnoth again I wrote a WML parser to update my old campaign code) and of course I've written programs for my university course (a basic chat client, the game of life, and a couple of other programming exercises). I also worked on a larger group project, as described in 2.2
2.2) Just before the easter holidays I finished working on a graded group project for my course, a part of the course being to teach us how to work as a group, possibly as a group that disagrees on the best course of action. The group project required us to create automated cricket commentary based on the locations of the players on the pitch, as provided by a system of transmitters and receivers. We had to triangulate the player's locations based on the raw data and then interpret these locations such that we could send out meaningful commentary to twitter and RSS feeds, and create a top down view of the pitch that indicated player names and locations.
2.3) No, never.
2.4) No, although I was involved in Wesnoth before (I made a few art contributions to trunk, mainly doing grunt tasks for Jetryl) and, time permitting, I would like to become involved again once I finish uni.
2.5) Yes.
2.5.1/2.5.2) I have played a variety of games over the years, some of my favourites have been strategy games, the civilization series in particular was quite enjoyable (more so the older ones than the newer ones) but I have also played MMOs, which I got entirely too addicted to before I realised I was about a month in and quit, and I quite enjoy FPS games because you can just pick one up for a bit and relax (especially left 4 dead, shooting zombies is just fun). Oh, and wesnoth too (you didn't really think it wouldn't get a mention?) although oddly enough in the end I was spending more time creating my campaign than I was playing the game.
2.5.3) Friendly ones, I dislike being insulted by random people while I'm trying to relax and generally would prefer a less challenging friendly player to a difficult interesting match against an annoying insulting player.
2.5.4) Do I have to pick one? I always watch videos and read the dialogue on the first playthrough (or after not playing a game for a while) so I value story, but a game without good gameplay is rather pointless.
2.5.5) Yes, I've mentioned it a few times earlier in the questionnaire. I tended to lean towards single player, but that was because at the time I didn't tend to have long periods of free time available to me, and I always felt quite rude asking someone to wait because I needed to do something.
2.6) Invasion of Arendia Campaign, and some sprite contributions (I never made good enough portraits), the one I can clearly remember doing is helping Jetryl with the attack animations of the Orcish Archer. (not that art contributions are particularly relevant for gsoc)

Communication Skills

3.1) Born and raised in England, so quite fluent.
3.2) English.
3.3) I tend to be friendly and courteous while talking on the internet, in any way, and I tend to avoid people who take a disliking to me (fortunately, even on MMOs there weren't many of them).
3.4) I've always been a great believer in constructive criticism, where it is asked for (or for anything destined for mainline in the specific case of Wesnoth)
3.5) I think so, Jetryl spent a long time trying to teach my to draw, and I like to think he didn't completely fail, but he probably has a good idea of how well I take advice.
3.6) Again I like to think so.
3.7) To be honest I veer between the two. If I'm not coding at the time, I might spend allot of time thinking about how I would go about doing something, and considering possibilities. But that tends to happen before I begin any specific task, once I've started I'll write something, see how it works out, see if it can be improved, and then either use or abandon it. I'm definitely not afraid of abandoning work if it actually makes the code worse, or has some unforseen problematic side effect (eg, slowing the program down more than expected).

Project

4.1/4.3) I chose the AI improvement project, mainly because I've always had an interest in AI and the main AI GSoC task set by the Wesnoth devs will familiarize me with the AI code so that I can mess around with it more easily later (or in other words, do the third part of my proposal) which is what I really want to focus on, even thought the main bit of the project is getting the first two stages done.

Timeline (4.4)

now- Jun 12 Revision and exams, which has to take priority. However I will be on IRC during this time and will try to familiarise myself with how the wesnoth dev team works.
Jun 13 - Jun 15 Familiarize myself with the relevant sections of code and discuss implementation in further detail with my mentor.
Jun 16 - Jul 13 By this point I would like for the Lua scripts to have access to all of the information and functionality that the current AI has, so phase one should be complete, and I would like to have started to create the 'wesnoth lua ai standard library' for use by AI developers. During this time I will also have asked what kinds of AI behaviour that scenario developers would find useful so that I can construct a list of high-level functions needed.
Jul 14 - Jul 15 During these two days I will 'finalize' the list of required high-level functions for the project, although of course there's nothing stopping more being made, and arrange time with Noy, or another proficient multiplayer player, to find out how they might go about achieving the objectives of the Lua Scripts as a human player.
Jul 16 - Aug 15 During this second half of GSoC I would like to 'complete' full libraries of standard functions for AI and Scenario Creators to use. However the amount of work involved will vary depending on what I am asked to make, and on how well the functions perform under testing, so this may be done relatively quickly, or I may not finish it before the end of GSoC.
Aug 16 Onwards Work on the Wesnoth AI with Crab, attempt to improve it's performance against humans. The actual work of this step will depend on what me and Crab come up with and on experience gained creating the functions and how well they work.

Technical Details (4.5)

Phase 1 - Giving Lua Scripts Access to all the Neccessary Information

The first goal is relatively simple. C++ obejcts used by the c++ AI of Wesnoth communicate with lua scipt AIs through c++ proxy objects, but at the moment this communication is incomplete and the lua scripts do not have access to all of the information available to the c++ AI. Phase 1 will involve coding functions to fetch this data from the c++ side of wesnoth so that lua AIs have access to this information. This information is then used in Phase 2 in order to construct the 'wesnoth lua ai standard library' in order to convert this data into meaningful information that the AI can base it's decisions on.

Phase 2 - Create Lua functions for AI Programmers and Scenario Creators

The next steps listed by the devs is to build a 'wesnoth lua ai standard library', and then 'build a library of high-level functions which will be directly usable by scenario developer'. However I suspect that these two tasks would be best performed semi concurrently, so once the obvious standard functions have been added to the standard library (things like evaluate the positive or negative effect of the action I am considering, and check which tiles can be moved to) I would start building the high level functions, and then add any recurringly useful or necessary functions to the standard library.

Creating the high-level functions would involve consulting with the better more experienced human players, such as Noy, in order to find out what tactics they would use in certain situations, as the majority of these functions are either 'do this, unless certain conditions are met' or 'under these circumstances, use these tactics'. Examples of the first include guard and patrol, the AI needs to know if and when to pursue an enemy fleeing from the location or area being guarded or patrolled, an example of the second is if the AI is told to kill a certain unit of the players, and it finds itself in a position to trap it between two units (two units with ZoC on opposite sides of an enemy unit will restrict it's movement options to squares immediately adjacent to it) it should probably do that, even at the expense of other opportunities. These Lua scripts would be run before the main loop of the AI turn sequence (http://wiki.wesnoth.org/Customizing_AI_in_Wesnoth_1.8#Customizing_AI_turn_sequence) however the behaviour of these scripts would be destructive, as the first script to be run will not consider the implications of it's actions on the options of the other scripts. Scripts could be made to account for multiple units acting under the same parameters (multiple units guarding for example) however writing scripts for every combination, especially as more are added, would be infeasible.

Phase 3 - General AI Improvements

The final goal is much harder to achieve, especially as there's no way of being 'done', but I plan to continue to work on it even after GSoC has ended and I have a few different ideas of how to go about doing it ranging from extending the current implementation by including considerations about the terrain that the units end up on (something currently ignored, which makes baiting the AI quite easy) to implementing a more Heuristic approach to the AIs decision making (treating the set of possible moves as a network that the AI must traverse where it wishes to avoid worse states and approach better ones), although a fully heuristic approach is of course impossible, wesnoth is far too complex and needs to run on not even just average desktops and laptops, but older ones too, and a fully implemented heuristic approach would take hours to run for a single turn on these computers. My heuristic implementation would use heuristic algorithms to decide which decisions it should investigate and which 'paths of thought' it should abandon. This will leave some potentially good choices un-investigated, as the first few steps may be bad moves but later ones sufficiently beneficial to make up for it.


4.6) I expect to gain familiarity with Wesnoth's AI code, and experience in creating and testing the performance of AIs in a real system instead of just studying the theory behind them.

4.7) Anything short of making enemies of every dev involved, but as a secondary priority to university of course.

Practical Considerations

5.1) Subversion: yes.
C++: although my course does cover C++, most of the teaching was done in java. I have not used C++ much, but I have used C more.
STL, Boost, sdl: I'm not familiar with them.
Python: never used.
build environments: I've never used cmake or scons.
WML: used extensively about three to four years ago.
Lue: never used.
5.2) Eclipse mainly. It's a useful tool that immediately highlights simple typos or smaller errors, and it provides useful bug fixing information.
5.3) Java.
5.4) I wouldn't mind, phone number to be included later.

This page was last edited on 24 April 2023, at 02:12.