Hi Cristian, I doubt I'm the right person to respond to you, since I'm very new to programming for Wesnoth. I've played Wesnoth for quite a while, and I started to build a campaign a while back, but so far that's the extent of my involvement. There are developers here who know the AI inside and out.
But I just wanted to thank you for considering Wesnoth as a project. And thank you for caring about free/open-source software in general. Here are some of my thoughts: I'm thinking that parallel computing would be very successful in creating a stronger AI. With enough processing power, you could make it possible for the AI to consider enough possibilities to beat most or possibly all human opponents. But should that be the goal? Would it be better to create an unbeatable AI, or an AI that is challenging, and interesting to play against, but can sometimes be defeated? If the goal is to create an AI that is just barely good enough, then perhaps a heuristic approach could be preferable. Something that is fast enough to run on an anyone's computer, even someone with older hardware. As far as I know, the current AI uses weighted values to calculate the value of each move. Without having seen the AI code, but just from game play observation, I'm thinking that the AI begins considering units from the top left corner of the map, starting with the first unit on its own side that it locates, and then chooses the best attack for that unit. I could be way off base, but if that is case, then the AI is using a faster, more limited strategy. You may be right that the AI is not thinking about the bigger picture. If that's the case, then the AI could be improved like you suggest. One significant obstacle could be the how quickly the number of possible moves increases when the AI begins considering more options. The fastest approach might be to simply iterate through the AI units, and decide on the best move for each unit in turn. But this can lead to bad strategy. For example, suppose that an undead AI is facing a weakened human leader, and has mostly level zero corpses, but also a small number of level two units. The corpses move first--on the basis of their position, they are the first units that the AI considers--and because killing the human leader has a high value, the AI would surround the human leader with corpses. But level zero corpses are weak, and the human leader may very well survive the attacks. Next turn, the human may bring reinforcements into play, and the AI may lose. If the AI had considered not only the best move for each unit, but also identified the best unit for the mission, then the AI would have sent its level two units to kill the leader instead, and that probably would have resulted in an immediate victory for the AI. This could be fun to play against. However, it would be very computationally-intensive for the AI to consider every possible move for every unit under its control when it decides how to attack each player unit in turn. The number of possibilities could increase very fast. The AI decision problem might end up requiring substantial processing time on the average user's computer. One possible solution could be identifying ways to eliminate in advance those moves that are not likely to be the optimal moves. For example, if it's not likely that three zombies can kill the human leader, then it doesn't matter *which* three zombies the AI sends: we can discount all of these possibilities at once, and focus only on the few movements which involve one or more of the level two units. If you're clever about this, you may be able to generate very success AI movements without significantly increasing the processing requirements--or perhaps even reducing them! Another possible idea, which wouldn't necessarily make the AI better, but could make the game more fun to play, would be to use different parameters for different units. It might be interesting if some units rush into battle without thinking, while other units plan their move more carefully. Perhaps the AI algorithm could consider fewer moves for the stupid corpses than when it is considering moves for the lich ruler. It might also be interesting if different units also had different parameters when the AI calculates the value for their attacks. Some units, like the dwarvish berserkers, might place little or no value on survival. They could be given combat parameters that would lead them to attack blindly. Other units might act differently. This could add an element of strategic depth to the game. Both the number of possibilities that are considered for a unit, as well as the parameters that are used to calculate the value of each move, could be made tunable. As far as I can tell, there are already tunable parameters like this that apply to the entire AI side as a whole. Perhaps this could be extended? I hope these are some useful ideas. Hopefully some of the actual AI developers will clarify and correct me where I'm wrong! And thank you again for thinking about this as a project, ~Spencer _______________________________________________ Wesnoth-dev mailing list [email protected] https://mail.gna.org/listinfo/wesnoth-dev
