User:Gscai/GSoC Proposal
From Unknown Horizons - Wiki
Contents |
Goals
- Incremental development: the idea is to have a basic AI working by the end of week 4 and then keep building on that. This should make it easy to objectively evaluate the progress and keep motivation high by the virtue of continuous progress.
- Data driven decisions: the AI would care about the properties (not the identities) of the objects and resources. This makes the AI use new objects and resources without extra work.
Design breakdown
The purpose of the following breakdown of the AI is to simplify each of the parts by separating concerns. The addition of a combat system will demand an extra modules that decide which military units to produce, a tactical module that actually uses the units, and some additions to the high level planner to make it actually decide that it wants to have a military and defend/attack.
High level planner
Decides how much of a resources to produce, how large each of its villages should be, who to attack (outside the scope of this project), etc. It would be driven by subgoals and their expected values at the time of evaluation. Example subgoals:
- Set production of a resource to X per time unit
- Set number of sailors to at least N on island M
- Sell N units of a resource to player P
- Create a monopoly in a resource
Each of the subgoals would have an evaluation function that would calculate the expected utility of doing it. Example factors that could determine the value of an action:
- initial cost in gold and resources
- expected cost over N turns
- the subjective value of having the buildings/units/resources according to their utility values
- the winning conditions
- the value of helping a friend
- the value of disturbing an enemy
Production chain planner
Decides upon the best way to produce a resource. For example if one of its subgoals is to produce textile then it would apply a backwards search from all ways of producing textile. It would find out that a Weaver's tent produces textile but requires wool. Further search would show that a Farm would produce wool but requires a Pasture in its range to do that. Now that the AI knows of a way to produce textile it needs to build the weaver's hut, the farm and the pasture. It would take 850 gold initially, 25 gold per time unit, 4 units of tools, and 8 units of planks. If the resources exist then the AI can give that request over to the resource builder part which will actually build all the buildings. The advantage of this approach is that the AI only has to know about the concepts and not specific objects. For example it has to know that a farm requires its pastures to be in a certain area around it while a weaver's hut could also be near a storage tent.
Village builder
Handles placement of all village buildings, estimates the cost of adding such buildings (the cost may be higher than normal if extra main squares, storage tents, etc are needed).
Resource builder
Handles placement of all other buildings except war related ones, estimates the cost of adding such buildings.
Land manager
Divides currently controlled islands into zones: village, resource gathering, defence, unit production. If any of the areas becomes full then it will either redistribute the land or request more land from the high level planner.
Defence builder (probably outside the scope of this project)
Handles placement of walls and towers.
Military builder (mostly outside the scope of this project)
Handles placement of military unit production buildings, trains units.
Personalities
It is desirable to make different AI characters behave in slightly different ways. My approach would to be assign utility values to buildings, islands, resources, etc. That way the AI would choose the option with a higher utility value in case there are many roughly equal options. For example when choosing an island to settle one could consider:
- available resources
- size
- connectivity (big open spaces are well connected, mountains, rivers, lakes, etc lower it)
- distance to other player's islands
- distance to other islands it might want to control in the future
- distance to opponent islands
To actually take all of these into account one could multiply each of them with a personality dependent weight, sum them up, and then take the highest valued one. Different personalities would have slightly different weights. For example a defensive player would try to keep its islands away from its opponents while an aggressive one might want to be close to the players it wants to attack later on.
Milestones
| Milestone 1 | June 17 | The AI can take the initial ship, choose an island, settle on it, and then reach and maintain a population of 30 sailors on that island. |
| Milestone 2 | July 8 | The AI can reach and maintain a population of 100 settlers on a single island. |
| Mid-term evaluations deadline | July 15 | |
| Milestone 3 | July 22 | Multiple AIs in a single game, the AI buys and sells goods on its island and on other players' islands. |
| Milestone 4 | August 15 | The AI can reach and maintain a global population of at least 300 inhabitants, it can expand to other islands and transfer resources between them. It is possible to set basic personality traits that affect the way it plays. |
| Firm 'pencils down' date | August 22 | Final testing, improving documentation and code quality. |
The milestones have been chosen so that it would be possible to evaluate the progress in an objective way and be reachable with a reasonable amount of effort according to my experience.