Help with testing Fred - Freelands MP Custom AI v0.14.15
Moderator: Forum Moderators
Re: Help with testing Fred - Freelands MP Custom AI v0.14.9
Huh, that's strange. The message complains about Lua function table.maxn() not existing. That function was indeed deprecated in Lua 5.2 and removed in 5.3 (I think), but I don't understand why this starts producing errors now. I don't see anything in the Wesnoth changelog since the update to 5.3.4 in Wesnoth 1.13.10. Also, I didn't get that error in my own tests. I'm traveling and don't have access to a compiled version of current master right now though (will have one by the end of the week), so I've been testing with 1.13.11, so maybe something's changed since then that I am not aware of.
Well, whatever the cause, the fix is simple and has been committed. Thanks for reporting.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.10
So ....
I took a while off from working on Fred because RL was crazy, because I wanted to concentrate on getting my SP campaigns ported to 1.14 and, well, mostly because I wanted some time off. I've been re-familiarizing myself with the status of the code over the last few days and am back at it now.
First thing I did was committing all the previous changes and releasing this as a new version to both the 1.12 and 1.14 add-ons servers. This means that:
Fred / AI-demos v0.14.10 is now available on the Wesnoth 1.12 and 1.14 add-ons servers
A couple important comments: If you've played against Fred before, there's no need to bother with this version. It's a lot of partial fixes to existing problems, some of which are probably making some aspects temporarily worse. The next thing that needs to happen is some serious work on the operations layer which, I hope, will in the end actually make a real difference.
First, however, I am going to remove all the conditionals and duplicate code that makes AI-demos work in both 1.12 and 1.14 and properly port everything to work correctly and without deprecation warnings in 1.14, and 1.14 only. Thus, starting from AI-demos v0.14.11, support for Wesnoth 1.12 will be discontinued. That part isn't all that much work, I think (hope), so I should have that version out within a week or two, after which I'll be back to working on the AI behavior itself.
Anyway, tl;dr. There remains just this:
I took a while off from working on Fred because RL was crazy, because I wanted to concentrate on getting my SP campaigns ported to 1.14 and, well, mostly because I wanted some time off. I've been re-familiarizing myself with the status of the code over the last few days and am back at it now.
First thing I did was committing all the previous changes and releasing this as a new version to both the 1.12 and 1.14 add-ons servers. This means that:
Fred / AI-demos v0.14.10 is now available on the Wesnoth 1.12 and 1.14 add-ons servers
A couple important comments: If you've played against Fred before, there's no need to bother with this version. It's a lot of partial fixes to existing problems, some of which are probably making some aspects temporarily worse. The next thing that needs to happen is some serious work on the operations layer which, I hope, will in the end actually make a real difference.
First, however, I am going to remove all the conditionals and duplicate code that makes AI-demos work in both 1.12 and 1.14 and properly port everything to work correctly and without deprecation warnings in 1.14, and 1.14 only. Thus, starting from AI-demos v0.14.11, support for Wesnoth 1.12 will be discontinued. That part isn't all that much work, I think (hope), so I should have that version out within a week or two, after which I'll be back to working on the AI behavior itself.
Anyway, tl;dr. There remains just this:
v0.14.10 complete changelog
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.10
The changelog looks pretty enticing so I might have to bother just the same.
Huzzah!
Re: Help with testing Fred - Freelands MP Custom AI v0.14.10
Well, I won't tell you not to, of course, any input is great, but ... The problem is that some of these new changes aren't balanced right yet. Things like "discourage advancing behind enemy lines without sufficient support" do what they say, but they also cause Fred to be (yet again) too hesitant in some situations. Essentially, it comes down to what you comment on next:Cold Steel wrote: ↑May 10th, 2018, 4:52 amThe changelog looks pretty enticing so I might have to bother just the same.
I know I have been saying that I'd do this for several releases now, and then I've always gotten side-tracked by problems I found in the tactical layer. This last round of changes really made it obvious though that I am at a dead end here unless I do actually put in the work on the operations layer. So that's next — until I find something else to distract me.
[There's also a not super long, but noticeable delay before every single move now, but that's a comparatively minor issue that I will take care of once the functionality is there.]
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.10
Yeah, the operations layer is the holy grail for wesnoth AI.
Very excited.
Very excited.
Re: Help with testing Fred - Freelands MP Custom AI v0.14.10
Just a bit of fun with v14.10:
It could be that I am rusty, but I did not notice any new or severe issues from the tactical layer. The utility weightings seemed about right.
It could be that I am rusty, but I did not notice any new or severe issues from the tactical layer. The utility weightings seemed about right.
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Thanks, Cold Steel, for continuously doing all that play testing (those are some long games!) and posting the replays! Looks like maybe I did not make things significantly worse in 1.14.10 after all. And I'll get a couple nice new test cases out of this.
In the meantime, I just released v0.14.11 with the announced move to Wesnoth 1.14 only. This release consists almost entirely of internal changes and clean-up (well, and the removal of some outdated or broken code or things that are now in Wesnoth mainline). None of Fred's behavior has been changed.
I will now move on to working on the operations layer. I have no idea how long it is going to take until I have progress that will actually make a difference. I am sure that it will take some time, but I am hoping that it is a question of when, not if.
In the meantime, I just released v0.14.11 with the announced move to Wesnoth 1.14 only. This release consists almost entirely of internal changes and clean-up (well, and the removal of some outdated or broken code or things that are now in Wesnoth mainline). None of Fred's behavior has been changed.
I will now move on to working on the operations layer. I have no idea how long it is going to take until I have progress that will actually make a difference. I am sure that it will take some time, but I am hoping that it is a question of when, not if.
v0.14.10 complete changelog
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
The funny thing is, they are so long because I tried to make them shorter with more aggressive play early on. Fred did a good job of punishing that recklessness as I should by now have expected.
Looking at your formidable task list for the operations feature, I wonder if it could be broken up over a number of versions? I imagine many of those sub features will heavily influence each other to the point they may be inseparable. But breaking it up allows you to better evaluate the effects and appreciate the progress you are making so that you do not lose your mind in the middle of it.
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Well, that's good to know.Cold Steel wrote: ↑May 18th, 2018, 4:36 pm The funny thing is, they are so long because I tried to make them shorter with more aggressive play early on. Fred did a good job of punishing that recklessness as I should by now have expected.
Yeah, I agree, and that's certainly the plan. I am not entirely sure yet what is needed for that and what steps might make sense for intermediate release, but they always seem to present themselves as I go along. I'll keep you posted. It's too late for my mind though!Cold Steel wrote: ↑May 18th, 2018, 4:36 pm Looking at your formidable task list for the operations feature, I wonder if it could be broken up over a number of versions? I imagine many of those sub features will heavily influence each other to the point they may be inseparable. But breaking it up allows you to better evaluate the effects and appreciate the progress you are making so that you do not lose your mind in the middle of it.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Hello,
First, thank you very much @mattsc for all your great and hard work on Lua AIs and micro AIs for Wesnoth. (Without all that I would not even start and explore the domain, or only in mind, which cannot go very far...)
I wish here to expose a very general idea. Sorry to post here [*]. And more sorry for the big post. (Also, english is a foreign lang for me so it may be a little hard to understand, but it is not my fault .)
Imagine a very simple scenario: 2-side battle, fair map, possibly designed equivalent or even symetric, few and ordinary unit types, maybe just 1 per side, no special "gifts" (abilities, weapon specials), no levelling thus no issue of XP... The only difference between the sides is that side 1 recruits more but weaker units while side 2 recruits less but stronger units. Those unit types may be level 1 and 2, but tweaked to make them weaker/stronger in a simple way, to make things obvious, say the stronger type just inflicts double damage.
If we did so strictly and clearly and simply, as human player or AI designer, we would never win with side 1 (numerous weak units). All else being equal or random, despite our bigger number of units (which lead to local balanced ot advantageous situations) most combat opportunities would be in favor of side 2.
And yet, the scenario is fair and balanced, and any non-novice human player will easily win (with either side for the matter) against the RCA AI. Fred is not directly concerned because of its specialisation (in map, faction, side), but indirectly probably. I started to think at this question after playing several times in a short while with or against only or mainly level 0 units. How would/could/should an AI be designed, in terms of fundamental principles, so that it "naturally" plays well such a game? especially with the side having numerous weak units.
This question radically crushed down my initial idea, more or less the same as yours (IIUC): try to evaluate the balance of damage (albeit I want the eval to remain approximate, but this is another question, related but distinct) (but firstly evaluating probas of death, yet another question, related but distinct). Obviously, since they basically deal half damage, weak units have few(er) opportunites to fight and deal more damage, even widening the evaluation to a "group attack" (my term), meaning including potential attacks by others units (time). [Further widening the evaluation obviously leads to include counter-attacks, which have even greater chances to be disadvantageous in stricts terms or ratio of damage, for the same reasons plus the question of initiative, firstly choice of weapon range but also choice of terrain etc...]
Note: AIs may not be that bad in such a situation for reasons which are clearly distinct from the principles hidden behind this question, such as blindly or exaggerately following ToD for instance (RCA AI not corrected is not that bad with level 0s because it is far too agressive and too few cautionous).
As often happens the answer popped up intuitively in my mind. But I know, also intuitively, that it is only half right, thus half wrong, so that instead of elaborating I will say it as concise as possible, expecting collective intelligence: expose your own reflexions and/or answers, and let us all brass all that into a better understanding. So my present answer is:
(Consider the contrast with: Attack when the balance of damage is favorable.)
(And apply this to the example exposed above.)
I also wish to open another reflexion caused by this one, which I call "meta-criterion". what is the criterion to judge an AI criterion? (a factor of choice, since finally AI as well as human play is all about choosing) My present idea is that an AI criterion is good if ever it makes a favorable difference in average (or it is better than random, or than ignoring it, or than processing it wrongly...)
Thank you,
Diniz
[*] Please someone create an AI forum; for both AI usage & research/developpement, both standard and custom AIs, both general and micro AIS. It would help very much to share and mix and improve reflexion and also knowledge (of existing AIs, their usage, their principles). And basically: where to post AI questions or reflexions?
First, thank you very much @mattsc for all your great and hard work on Lua AIs and micro AIs for Wesnoth. (Without all that I would not even start and explore the domain, or only in mind, which cannot go very far...)
I wish here to expose a very general idea. Sorry to post here [*]. And more sorry for the big post. (Also, english is a foreign lang for me so it may be a little hard to understand, but it is not my fault .)
Imagine a very simple scenario: 2-side battle, fair map, possibly designed equivalent or even symetric, few and ordinary unit types, maybe just 1 per side, no special "gifts" (abilities, weapon specials), no levelling thus no issue of XP... The only difference between the sides is that side 1 recruits more but weaker units while side 2 recruits less but stronger units. Those unit types may be level 1 and 2, but tweaked to make them weaker/stronger in a simple way, to make things obvious, say the stronger type just inflicts double damage.
- How would you play this to win, in either case? (side 1 or 2)
- How should an AI be designed to (have an optimal probability to) win with side 1? side 2?
- How should an AI be designed to win whatever the side it controls?
Attack when the balance of damage is positive.
(I hope I understood it rightly, because you wrote it out of context.)If we did so strictly and clearly and simply, as human player or AI designer, we would never win with side 1 (numerous weak units). All else being equal or random, despite our bigger number of units (which lead to local balanced ot advantageous situations) most combat opportunities would be in favor of side 2.
And yet, the scenario is fair and balanced, and any non-novice human player will easily win (with either side for the matter) against the RCA AI. Fred is not directly concerned because of its specialisation (in map, faction, side), but indirectly probably. I started to think at this question after playing several times in a short while with or against only or mainly level 0 units. How would/could/should an AI be designed, in terms of fundamental principles, so that it "naturally" plays well such a game? especially with the side having numerous weak units.
This question radically crushed down my initial idea, more or less the same as yours (IIUC): try to evaluate the balance of damage (albeit I want the eval to remain approximate, but this is another question, related but distinct) (but firstly evaluating probas of death, yet another question, related but distinct). Obviously, since they basically deal half damage, weak units have few(er) opportunites to fight and deal more damage, even widening the evaluation to a "group attack" (my term), meaning including potential attacks by others units (time). [Further widening the evaluation obviously leads to include counter-attacks, which have even greater chances to be disadvantageous in stricts terms or ratio of damage, for the same reasons plus the question of initiative, firstly choice of weapon range but also choice of terrain etc...]
Note: AIs may not be that bad in such a situation for reasons which are clearly distinct from the principles hidden behind this question, such as blindly or exaggerately following ToD for instance (RCA AI not corrected is not that bad with level 0s because it is far too agressive and too few cautionous).
As often happens the answer popped up intuitively in my mind. But I know, also intuitively, that it is only half right, thus half wrong, so that instead of elaborating I will say it as concise as possible, expecting collective intelligence: expose your own reflexions and/or answers, and let us all brass all that into a better understanding. So my present answer is:
Attack when the situation is better than average.
(or than random, or than statistical expectancy...)(Consider the contrast with: Attack when the balance of damage is favorable.)
(And apply this to the example exposed above.)
I also wish to open another reflexion caused by this one, which I call "meta-criterion". what is the criterion to judge an AI criterion? (a factor of choice, since finally AI as well as human play is all about choosing) My present idea is that an AI criterion is good if ever it makes a favorable difference in average (or it is better than random, or than ignoring it, or than processing it wrongly...)
Thank you,
Diniz
[*] Please someone create an AI forum; for both AI usage & research/developpement, both standard and custom AIs, both general and micro AIS. It would help very much to share and mix and improve reflexion and also knowledge (of existing AIs, their usage, their principles). And basically: where to post AI questions or reflexions?
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Hi denispir,
No problem posting here, as far as I am concerned. This thread or opening your own thread would also be possible, but this is very similar to some of the ideas implemented in Fred, so this is perfectly appropriate.
As for your comment concerning a dedicated AI forum, you could write the forum moderators group, but TBH there aren't all that many AI topics, so they might not consider that worth it. The Coder's Corner forum used to say in its description that it was for AI topics, but I just saw that it does not state so specifically any more. Anyways, that's the place where AI topics usually go.
As for your comments on AI evaluations, I entirely agree. I don't know in what context that statement of mine that you quote was made, but it was either an early version or just a very high-level summary. I mean, that is part of the individual attack evaluation in the tactics layer, but there are also additional considerations in the operations layer that lay out the overall strategy and make the AI more aggressive when the overall situation is good and less so when it is bad. So the damage calculation gets influenced by overall modifiers.
Let me give you another simple example when straight out damage statistics don't work well. Let's say you have a valuable unit that has one strike and 1 HP. It is up against an enemy unit with the same stats and both are on 50% defense terrain. You attack and strike first, so you have a 50% chance of killing the enemy. If you miss, the enemy strikes back and has a 50% chance of killing your unit, making it an overall 25% probability of you losing your unit. So, statistically, things are very strongly in your favor. As a human player, would you do that attack? And the answer is, it depends. If there are a large number of pairings like that on the map: sure I would, because overall (on average) it would come out in my favor. If this were the only pairing like that, and if that unit were important: hell no, 25% chance of losing it is way too high a risk.
So what I am saying is that I agree with you, and what I am trying to do with Fred is to implement more of the kind of thought processes that a human player goes through. What I am learning though is that the devil is in the details, and that finding something that works in general is quite hard to do. General thoughts like these are good and important, but making things work in practice, and in particular in a general setting, is very difficult, at least for me.
I'm afraid I don't really have much more to add at this time. Maybe I missed something you wanted me to comment on specifically. Please remind me if that's the case.
BTW, I have not replied to your other post, because I do not really have anything to add there. What you write there sounds good in general too, but in my experience until you actual try something like that in practice, it's hard to say if it will work as you imagine. Same comment as above, really.
No problem posting here, as far as I am concerned. This thread or opening your own thread would also be possible, but this is very similar to some of the ideas implemented in Fred, so this is perfectly appropriate.
As for your comment concerning a dedicated AI forum, you could write the forum moderators group, but TBH there aren't all that many AI topics, so they might not consider that worth it. The Coder's Corner forum used to say in its description that it was for AI topics, but I just saw that it does not state so specifically any more. Anyways, that's the place where AI topics usually go.
As for your comments on AI evaluations, I entirely agree. I don't know in what context that statement of mine that you quote was made, but it was either an early version or just a very high-level summary. I mean, that is part of the individual attack evaluation in the tactics layer, but there are also additional considerations in the operations layer that lay out the overall strategy and make the AI more aggressive when the overall situation is good and less so when it is bad. So the damage calculation gets influenced by overall modifiers.
Let me give you another simple example when straight out damage statistics don't work well. Let's say you have a valuable unit that has one strike and 1 HP. It is up against an enemy unit with the same stats and both are on 50% defense terrain. You attack and strike first, so you have a 50% chance of killing the enemy. If you miss, the enemy strikes back and has a 50% chance of killing your unit, making it an overall 25% probability of you losing your unit. So, statistically, things are very strongly in your favor. As a human player, would you do that attack? And the answer is, it depends. If there are a large number of pairings like that on the map: sure I would, because overall (on average) it would come out in my favor. If this were the only pairing like that, and if that unit were important: hell no, 25% chance of losing it is way too high a risk.
So what I am saying is that I agree with you, and what I am trying to do with Fred is to implement more of the kind of thought processes that a human player goes through. What I am learning though is that the devil is in the details, and that finding something that works in general is quite hard to do. General thoughts like these are good and important, but making things work in practice, and in particular in a general setting, is very difficult, at least for me.
I'm afraid I don't really have much more to add at this time. Maybe I missed something you wanted me to comment on specifically. Please remind me if that's the case.
BTW, I have not replied to your other post, because I do not really have anything to add there. What you write there sounds good in general too, but in my experience until you actual try something like that in practice, it's hard to say if it will work as you imagine. Same comment as above, really.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Hello @mattsc,
For some reason I had not seen your reply here, just checked now (before addressing the question in our other exchange thread). I have some more reflexions on the topic and want to insist or make clearer the core principle "better than average": it is really different from "positive balance of damage", even if you widen the evaluation.
Below, as above in my previous post, I assert ideas as if they were grand truths. Writing thus is simpler (and the ordinary way in our culture). In fact, they are just the present state of my reflexion, which may change (it has already as you'll see), and may well be partially or totally wrong (a still hidden to me, really right criterion may indeed exist).
[Remind that in the example case, stronger units just deal twice more damage, but (this remained implicite) have the same max_HPs. Thus, in general or statistically, each side just needs to deal a little more damage than proportionnally (half/double) to win.]
Why side 1 loses, and what it should do:
The "standard" attack criterion of balance of damage obviously leads to very few, if any, good opportunities of attack for side 1, just because they deal half damage in average, even with the help of good ToD and favorable terrain. Since the attacker chooses when (ToD), where (terrain defence), when/where (situation), and attack distance, indeed having more attack initiatives is good overall; and just leads to victory in an ordinary battle scenario (one that does not require a specific tactic imagined and setup by the scenario author --as you often do ).
The right criterion for side 1 is just to attack when it deals more damage than it would do by random attacks, meaning more than average. This is enough to win in general, since it leads to more than half as many kills (in this example case). (In this case, this also means more than half the damage dealt by side 2, but *this is notthe criterion, see below.)
Why widening the evaluation is not the same:
Widening the evaluation, to more units and more turns and more space, indeed increases the number of attack initiatives for side 1, since there will often be 2 or 3 weak units facing 1 strong unit, or similar at higher scales. But all in all there will still be more favorable attacks for side 2. And anyway this is not the same as changing the basic criterion of attack, the idea I am testing here: we are still deciding on a positive balance of damage, just at a larger scale. It is not only not good enough as basic criterion, it is really different from "better than average".
Same for side 2, see below.
Why side 2 (less but stronger units) also loses:
I just realised that side 2 also loses with the standard criterion of attack. It will often attack, maybe very often (if there are many cases of 1 vs 1), each time the balance of damage is positive, which means also in many bad situations of terrain or ToD. But positive balance is not enough: side 2 needs to attack when the situation is favorable, and only then, meaning when it deals more than average damage, again. This is required to win in general, to deal more than twice more damage overall, thus kill twice more units.
Again, widening the evaluated situation would lead to side 2 avoid some of the wrong cases of attack; again this is not the right criterion.
"better than average"
With terrain defence and ToD, Wesnoth rules create situations where the (expected) damage is better or worse than average. Without such rules, favorable situations would only appear with "zonal" unbalance of forces (1). In any case, it is precisely such situations that need to be used when they happen; and that need to be created or avoided at a tactical level. Such situations lead to "better than average" outcome; and that's what we need to win, and all what we need. If the scenario is more or less fair, indeed, see below the case of human players and an attempt at generalisation.
Thus, the criterion I am trying to introduce may be called "better than average" but also "favorable situation" (or advantageous) and it is also equivalent to "better than random".
general tactic:
We can go as far as saying that in a battle scenario, the basic tactic and also the goal of every tactical action, is to create more attack initiatives for our side; more good attack opportunities, meaning more advantageous situations. But when are they good in fact? what is the actual criterion? I pretend here that it is not more damage inflicted than the other side, but instead more damage than average (or than random) (or than probabilistic expected value).
For instance, this is just what we do (as human players or AI designers) when we agressively push our attacks in good ToD and retreat or reform our ranks when ToD changes. We do not, and do not need to, and should not, evaluate the balance of damage, neither individually for each 1-1 attack, nore globally. We know, and we are right on that, that such an approach is good overall; also whatever the composition of forces, including cases of disbalance of units levels. If we did not do so but instead evaluated the balance of damage, then we would often avoid attacking in right cases, and conversely attack in wrong cases.
AI design:
In AI design, this may as first approach lead to ignore damage computation altogether! Both for 1-1 potential fights and collective combat zones. But instead compute a mix of *factorsinfluencing damage (ToD, terrain, zonal ratio of forces, what else?). At different scales of situations for different "depths" of evaluation.
Against a human player all is different...:
The reasoning so far implicitely assumes a fair scenario overall. If I am right, then when forces are equivalent (2) deciding if/when to attack according to "situation is better than average" leads to victory (in general, or "all else being equal"). If other factors, eg a map with unbalanced terrains, are unfair, then the advantaged side will just win in general because it has more opportunities of good attack.
We know from experience that humans play better than the std AI, they can and do win in unfair situations. Similarly, we could have AIs of different skill levels, other than the criterion discussed here, in tactics in particular which as said above allows creating good situations and avoiding bad ones.
When the scenario is unfair we need to adapt the criterion: the davantaged side (eg an AI having 300 start gold against a human with 200) does not need a situation to be "better than average": with stronger forces, it can afford fighting in slightly bad cases. And it should do so to have a chance to win against a better opponent.
Conversely, we humans certainly (but how to check that?) only fight whenever the situation is much better than average, not just slightly. Our talent is our ability to provoke such situations, and avoid others. Read: our talent is firstly tactical. (However, we have much more also, at technical and strategic levels, but this is a distinct topic.)
...as well as at different difficulty levels:
Similarly, the criterion needs to be adapted for different difficulty levels, since unfairness increases with difficulty. The weaker an opponent (3), the more an AI should attack in moderately bad situations.
overall ratio of forces:
This leads to a more general criterion, also aplying to AI vs AI in principle, where "better then average" is weightened by a factor grossly reflecting the ratio of forces.
(1) Which can happen in a random or disordered manner, thus again balanced in average, and because of positive feedback loops (disbalance of forces mechanically increases), the winner will certainly be the side having the very first positive situations, even taking random into account. Or else such situations are actively created (and avoided) by players, AI or human, meaning a tactical level. Very similar in principle to chess, go, etc...
(2) Which can in first approach be evaluated by gold/income iff the composition of forces, meaning the diverse recruitable unit types, is also fair. Eg a single healer has such an impact that it disbalances all.
(3) To avoid yet another factor of positive feedback loop, we should not balance hard difficulty by strengthening the enemy but by handicaping the human player. Else, mechanically, through XP, better players have always stronger forces, meaning we are forced to oppose them even stronger AIs in later scnearios, etc... I mean, in campaigns.
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
At long last:
Fred / AI-demos v0.14.12 is now available on the Wesnoth 1.14 add-ons server
A few of the main points:
In summary, a few replays against (ideally different) human players would be extremely useful at this time. I don't need many, a couple would help a lot already and mostly I am interested in the big picture at the moment, although I will of course also look for glaring mistakes on the detail level.
In the meantime, I will keep working on those details and release new versions as I make progress, hopefully at a much quicker cadence than for 0.14.12.
Fred / AI-demos v0.14.12 is now available on the Wesnoth 1.14 add-ons server
Why it's taken so long since the last release
- The main restructuring of the operations layer is done with this release.
- Much work remains to be done on the detail level, of course, but that should be possible without another massive refactoring effort.
- The next couple releases will concentrate on fixing some of the known issues and improving the fine tuning and balancing. As an example, one of the main problems on the specific-action level at the moment is that Fred often unnecessarily puts injured units on the front line.
- After that, I would like to move on to expanding the AI to other factions, playing side 2, and then to playing other maps, doing further refinements as part of that process, rather than endlessly trying to improve Fred on Freelands. I bet I am not the only one who is getting tired of that.
I could use your help
In the meantime, I will keep working on those details and release new versions as I make progress, hopefully at a much quicker cadence than for 0.14.12.
v0.14.12 complete changelog
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
'
Excellent work as always, mattsc! Some replays:
Got a couple of nonfatal errors on the above loyalist match:
Not sure if you wanted to worry about optimizing yet, but there was a notable slow down while Fred was deciding what to do for turn 26 of the undead match.
Excellent work as always, mattsc! Some replays:
Got a couple of nonfatal errors on the above loyalist match:
Code: Select all
error scripting/lua: ~/add-ons/AI-demos/lua/fred_benefits_utilities.lua:535: attempt to perform arithmetic on a nil value (field '?')
stack traceback:
~/add-ons/AI-demos/lua/fred_benefits_utilities.lua:535: in field 'action_penalty'
~/add-ons/AI-demos/lua/fred_hold_utils.lua:483: in field 'find_best_combo'
~add-ons/AI-demos/lua/ca_zone_control.lua:2328: in upvalue 'get_hold_action'
~add-ons/AI-demos/lua/ca_zone_control.lua:3053: in function '.get_zone_action'
~add-ons/AI-demos/lua/ca_zone_control.lua:3257: in function <~add-ons/AI-demos/lua/ca_zone_control.lua:3177>
(...tail calls...)
Code: Select all
error scripting/lua: ~add-ons/AI-demos/lua/ca_zone_control.lua:3591: Fred to move out of way with dx = dy = 0
stack traceback:
[C]: in function '.error'
~add-ons/AI-demos/lua/ca_zone_control.lua:3591: in field 'execution'
[string "local self, params, data = ......"]:2: in main chunk
In the above matches, most of the time he seemed to protect the injured quite well, I thought.mattsc wrote: ↑April 17th, 2019, 4:35 pm The next couple releases will concentrate on fixing some of the known issues and improving the fine tuning and balancing. As an example, one of the main problems on the specific-action level at the moment is that Fred often unnecessarily puts injured units on the front line.
These are exciting times we live in!
Well try not to be too hard on him in any case. After all, he was devastatingly more lethal than default RCA years ago even. The moment he can play the other sides/factions on the other mainline map, is the moment RCA becomes obsolete.mattsc wrote: ↑April 17th, 2019, 4:35 pm However, I am reasonably confident that the mechanisms needed to adjust that sort of problem are in place now and require mostly tuning rather than yet another massive restructuring effort. In fact, if it turns out to be the latter I might be done with Fred ...
Re: Help with testing Fred - Freelands MP Custom AI v0.14.11
Thanks, name, for the kind words and especially for the testing and sending the replays. I can see some things that Fred is doing pretty well (better than before, I think), but also some serious issues. I'm pleased with the former, not surprised by the latter, so overall this is good.
For example, they show a mix of Fred being too defensive (again) and not attacking, but also exposing individual units or small groups too much and fragmenting. Getting units stranded in the corners is one of the symptoms of that. Oh, and I like the "let's leave our leader to be killed but use many units to hold off against that one walking corpse coming from the south" tactic at the end of the undead game.
BTW, I also received a few replays via direct messages in Discord which show quite similar overall behavior. So I know what to work on next. And as a note, while that might not seem very different from what he did before, the refactoring of the code means that (I think) I am in a better position to deal with this now. Still doesn't mean that I kow how to do that, but as I told somebody on Discord, figuring that out is part of the fun.
For example, they show a mix of Fred being too defensive (again) and not attacking, but also exposing individual units or small groups too much and fragmenting. Getting units stranded in the corners is one of the symptoms of that. Oh, and I like the "let's leave our leader to be killed but use many units to hold off against that one walking corpse coming from the south" tactic at the end of the undead game.
BTW, I also received a few replays via direct messages in Discord which show quite similar overall behavior. So I know what to work on next. And as a note, while that might not seem very different from what he did before, the refactoring of the code means that (I think) I am in a better position to deal with this now. Still doesn't mean that I kow how to do that, but as I told somebody on Discord, figuring that out is part of the fun.
The second also happened in one of the other replays and is already fixed. Do you remember at which turn (or approximately which turn) the first error happened?
Thanks. I'll have a look. Whether I'll do something about it depends on whether that's code that needs to be reworked anyway or whether it's relatively stable.
Some musings about expanding Fred's capabilities
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on