Topic: Improving the AI
hessenfarmer |
Posted at: 2020-02-16, 20:05
well if you know how to make one. --> feel free to tell us how this could be implemented in the code. Top Quote |
GunChleoc |
Posted at: 2020-02-21, 18:22
For determining map size, we could use Busy indexing nil values Top Quote |
hessenfarmer |
Posted at: 2020-04-21, 17:48
Ok I took some time to dig into the code of the AI warfare. I believe I found some Bugs and some room for Improvement to prevent the Ai from spoiling its soldiers. (basically wrong comparison operators in my view and a Copy past error leading to much to higher scores to attack. Will prepare a branch and test tonight. However these things should be changed best in b21 Top Quote |
Tibor |
Posted at: 2020-04-21, 19:49
these lines are part of genetic algorithm stuff and might or might not be considered based on result of previous training. And any change in this stuff should be followed by training to let AI figure out if these positions in the score are to be considered. But go on if you feel so.. Row 257 is indeed a copy error.. But even this fix should be followed by re-training.... Top Quote |
hessenfarmer |
Posted at: 2020-04-21, 21:01
I know they are part of gentics and are not considered if the Neuron is zero at this position. However if considered they encouraged attack when AI is weaker then then the opponent, which I deem wrong. Bad thiong is even after the first corrections the AI is still attacking until no soldier is left to attack. This will need deeper analysis As i doubt this could be cured purely by genetics. I agree that any changes would need training. However I am really eager to hunt this behaviour down to an acceptable level which one might call character or aggressiveness and not (extended) suicide. Top Quote |
Tibor |
Posted at: 2020-04-22, 07:30
I am willing to run some training after the change will be in the trunk.. Top Quote |
hessenfarmer |
Posted at: 2020-04-22, 10:05
Hi,
I just pushed a branch and drafted a pr to ease discussion and review. However the visible results are marginal at the best. Problem for me is that the logs in the evaluation of input scores do not work on my computer (or I miss some part to get them) so I am unsure about the values given and if some are just too high so they are masking every other decision. Edit: forgot to link the PR https://github.com/widelands/widelands/pull/3873/files Edited: 2020-04-22, 10:05
Top Quote |
blind3rdeye |
Posted at: 2020-04-22, 11:53
It seems to me that it may be problematic if parts of the AI are 'learning' by playing against other AI, but other parts are not. Effectively the AI has some constraints on it, and it is being trained to do its best against another AI with the same constraints. So it may be learning very effectively to play well against other AI opponents, but could fail hard against someone who plays differently. I keep thinking about why the AI keeps building so many sentries on the front-line. It builds heaps of them, and if I ever try to push my territory forward with a sentry, the AI attacks hard with a lot of soldiers. So then, I imagine if the AI is playing against a different AI to plays similarly, the one who builds the most sentries probably has an advantage. But when I play vs the AI, I instead just build a couple of barriers, and kill any sentries that pop up on the boarder. That means the AI can't really attack me at all because I'm out of the range. I can hold them off effectively even when their army is much stronger, because their mass of sentries are all out of range. What I'm saying is that AI learning against other AI might get stuck in a local optimum which is actually pretty poor; and it also might be incapable of escaping that local optimum due to constraints on what inputs and outputs they are given. Top Quote |
hessenfarmer |
Posted at: 2020-04-22, 12:47
Hi, Top Quote |
JanO |
Posted at: 2020-04-22, 13:49
I sometimes wonder: Would it be possible (of course, yes, but would it be possible with reasonable effort) to make the AI learning? I mean, let them change within a running game. Surely that would need some hard brainwork to find a way how to evaluate meaningful versus stupid decisions. Probably too complicated. Nevertheless, I would suggest to split up AI training for different tribes. Edited: 2020-04-22, 13:49
Top Quote |