Exercises in Formula and Lua AI and AI-demos add-on feedback
Moderator: Forum Moderators
Re: Exercises in Formula and Lua AI
One thing I noticed in my most recent game is that the AI doesn't appear to take beserk into account when considering threat. The undead kept placing dark adepts within range of my beserkers and giving me free XP as it couldn't fight back.
Re: Exercises in Formula and Lua AI
Same here!Quitch wrote: Also thanks to you, and all the others, working on this as well. People like me greatly appreciate your efforts
I can't imagine a more massively better way to improve Wesnoth from where it is now, than by working towards such big improvements in the AI. I started getting excited about this when I saw so many of the GSOC proposals were for AIs, with so many focused on improving defense, and now they are starting to get integrated.
Re: Exercises in Formula and Lua AI
One thing I noticed in my most recent game is that the AI doesn't appear to take beserk into account when considering threat. The undead kept placing dark adepts within range of my beserkers and giving me free XP as it couldn't fight back.
Spoiler:
Re: Exercises in Formula and Lua AI
Hey all, thanks for the continued comments. You're right, neither of the new AIs (Experimental AI, Ron, Fred) take berserk (or drain) into account yet, other than through the parts that are taken from the default Wesnoth (RCA) AI. The RCA AI attack calculation actually does take it into account, but only for rating attacks relative to each other. So if the best attack comes out to be one of the situations you describe, it will (generally) do that one. Berserk and drain considerations are on the list of things to be added to Ron/Fred soon.
As a side note, a lot of the situations you describe deal with placing units so that counter attacks on the next enemy turn do the least damage. That's really hard to do correctly (not in principle, but for computation time reasons because there are so many possible combinations). We're working on faster, approximate methods of dealing this (some moves do already, such as those involving the side leader), but it's also still work in progress.
As a side note, a lot of the situations you describe deal with placing units so that counter attacks on the next enemy turn do the least damage. That's really hard to do correctly (not in principle, but for computation time reasons because there are so many possible combinations). We're working on faster, approximate methods of dealing this (some moves do already, such as those involving the side leader), but it's also still work in progress.
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: Exercises in Formula and Lua AI
I can give a graphical mockup if that's what you are asking, code-wise I'm pretty much uselessCrow_T: Thanks. As for maps, the different AIs use all kinds of maps. There are sub-maps that simply split up the scenario maps into sections, such as what's happening on Freelands (as Rigor describes). Then there are maps that do ratings based on terrain, own and enemy strength, distance from something, etc. Some of them are pre-defined, some of them the AIs figure out themselves. Ideally, we'll eventually have an AI that can figure it out all by itself to some extent, but where the scenario designer has the option of adding pre-defined maps in order to improve play on a certain map. So I think that (some of) this is along the lines of what you are thinking. If you have more concrete ideas, by all means, please let us know.
- Alarantalara
- Art Contributor
- Posts: 787
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Exercises in Formula and Lua AI
Ron now takes advantage of the healer support micro AI to a small extent. While it wasn't enough to win in this game, it did manage to heal some units that would otherwise remained injured.
- Attachments
-
- 2p_—_Hamlets_replay.gz
- (24.64 KiB) Downloaded 459 times
Re: Exercises in Formula and Lua AI
This healer support thing is huge, lately I've been playing UMCs where the white mages/druids/etc. get thrown to the front lines only to get slaughtered the next turn. Is there a way to get them to attack a unit only if there is both a high chance to kill, and a high chance to be defended afterwords?
- Alarantalara
- Art Contributor
- Posts: 787
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Exercises in Formula and Lua AI
Of course there is. The full healer support AI only attacks if there is nothing to heal though it doesn't do anything special about attacking. Fred tries for more complete integration of attacking and defending so does a better job of keeping units defended though there isn't anything special about healers there yet. Some combination of both is needed to do what you want.
Re: Exercises in Formula and Lua AI
Replay using Fred 64ce829 and wesnoth 1.11.2-131-gc30e960, versus RCA AI with +4 income. Fred is making quite a few mistakes with the positioning of units near villages (but, of course, wins anyway).
- Attachments
-
- 2p_—_The_Freelands_replay.bz2
- (17.1 KiB) Downloaded 474 times
Re: Exercises in Formula and Lua AI
Thanks, AI. I will extract those situations for test cases.
A comment to those of you who don't follow the discussion on IRC: Fred 64ce829 is an intermediate development version that has known problems. I've made some changes to the inner workings and am getting back to trying to improve the actual behavior. AI's replay contains specific examples of things going wrong for me to work with. I am hopeful that we'll be able to release a new version soon(ish).
A comment to those of you who don't follow the discussion on IRC: Fred 64ce829 is an intermediate development version that has known problems. I've made some changes to the inner workings and am getting back to trying to improve the actual behavior. AI's replay contains specific examples of things going wrong for me to work with. I am hopeful that we'll be able to release a new version soon(ish).
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
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Exercises in Formula and Lua AI
lossless victory me vs Fred v0.12.2-301-gb56311b on wesnoth 1.11.2-282-g116778e
I think it doesn't cope quite well with my defensive style. On my right side it looked as if it wanted to rush all the time but never did.
things to improve:
-Throughout the game, from the point on when it first decided to not attack, the candidate action zone_control took very long to process (sometimes more than 100 secs). It's kind of painful.
-It completely left alone its leader in the end by sneaking the surviving units along the map edges.
I think it doesn't cope quite well with my defensive style. On my right side it looked as if it wanted to rush all the time but never did.
things to improve:
-Throughout the game, from the point on when it first decided to not attack, the candidate action zone_control took very long to process (sometimes more than 100 secs). It's kind of painful.
-It completely left alone its leader in the end by sneaking the surviving units along the map edges.
- Attachments
-
- 2S_–_Freies_Land_Wiederholung_anzeigen.zip
- (22.8 KiB) Downloaded 429 times
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: Exercises in Formula and Lua AI
AI-demos v0.12.3 has been released.
The main reason for this release is that some of the mainline Micro AI syntax was changed in a non backwards compatible way from Wesnoth 1.11.2 to 1.11.4 and that some of the MAI scenarios of AI-demos v0.12.2 do not work with 1.11.4 any more. Of course, the opposite is now true too: these scenarios now require 1.11.4 or later to work. All of this only affects (some of) the MAI test scenario, the MP AIs should be unaffected.
The main reason why it's been so long since the last release is that none of us has much time at the moment to work on the AIs, so Fred is still not doing as well as we'd like him to do. Don't get me wrong, lots of progress has been made and things are getting better, but there are still plenty of problems, such as those observed by Anonymissimus. We are (very) slowly working on this...
A lot of other changes, additions and improvements have been made. A few notable examples:
The main reason for this release is that some of the mainline Micro AI syntax was changed in a non backwards compatible way from Wesnoth 1.11.2 to 1.11.4 and that some of the MAI scenarios of AI-demos v0.12.2 do not work with 1.11.4 any more. Of course, the opposite is now true too: these scenarios now require 1.11.4 or later to work. All of this only affects (some of) the MAI test scenario, the MP AIs should be unaffected.
The main reason why it's been so long since the last release is that none of us has much time at the moment to work on the AIs, so Fred is still not doing as well as we'd like him to do. Don't get me wrong, lots of progress has been made and things are getting better, but there are still plenty of problems, such as those observed by Anonymissimus. We are (very) slowly working on this...
A lot of other changes, additions and improvements have been made. A few notable examples:
- Two new Micro_AIs (which are already in mainline): Goto and Zone Guardian
- A simple Lua AI Demo scenario that can be used as a template for people who want to write their own Lua AIs. (This might be separated out to its own add-on at some point.)
- The test scenario can now be started from the command line using the
-t aid_test
option.
Full changelog for v.0.12.3
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: Exercises in Formula and Lua AI
Hi,
Using 1.11.4, so this may already be fixed, but it looks like there is a problem with "return guardian" micro_ai. I got this with your test scenario ("wesnoth -t micro_ai_test", not an add-on), I think it happened because I blocked the AI troll from returning to its post on the turn after it attacked, but I'm not sure.
I don't know what this means, so I don't know if it is enough to be helpful, but this is what I got:
Using 1.11.4, so this may already be fixed, but it looks like there is a problem with "return guardian" micro_ai. I got this with your test scenario ("wesnoth -t micro_ai_test", not an add-on), I think it happened because I blocked the AI troll from returning to its post on the turn after it attacked, but I'm not sure.
I don't know what this means, so I don't know if it is enough to be helpful, but this is what I got:
Code: Select all
20130610 17:40:20 error scripting/lua: /usr/local/share/wesnoth1114/data/ai/lua/ai_helper.lua:959: attempt to index local 'x' (a nil value)
stack traceback:
/usr/local/share/wesnoth1114/data/ai/lua/ai_helper.lua:959: in function 'movefull_stopunit'
...esnoth1114/data/ai/micro_ais/ais/mai_guardian_engine.lua:130: in function 'return_guardian_exec'
[string "(...):return_guardian_exec({ ["id"] = "return..."]:1: in main chunk
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: Exercises in Formula and Lua AI
doofus-01: The return hex being blocked was indeed the reason why this happened and it had not been fixed yet. And yes, that error message together with your description was exactly what I needed. Thanks for reporting!
It's fixed in trunk now and will be in the next release (1.11.5).
It's fixed in trunk now and will be in the next release (1.11.5).
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: Exercises in Formula and Lua AI
I'd like to say that the work here is excellent, mattsc.
With a currentish 1.11.4+dev(git) version and the latest default+experimental era I found some interesting (buggy) play with ExpAI Fred: Rush AI for Freelands Side 1. Attached is a replay from a game where AI plays side 1 and I play side 2 with only half the gold of the AI. The AI plays poorly and I win without losing a unit. My RAM was maxed out by the end turns and the AI steadily took longer for each move, taking about 10 seconds for each move at the end. Mabye it is similar to what Anonymissimus has posted.
With a currentish 1.11.4+dev(git) version and the latest default+experimental era I found some interesting (buggy) play with ExpAI Fred: Rush AI for Freelands Side 1. Attached is a replay from a game where AI plays side 1 and I play side 2 with only half the gold of the AI. The AI plays poorly and I win without losing a unit. My RAM was maxed out by the end turns and the AI steadily took longer for each move, taking about 10 seconds for each move at the end. Mabye it is similar to what Anonymissimus has posted.
- Attachments
-
- 2p_—_The_Freelands_replay_vs_AI.gz
- (17.01 KiB) Downloaded 415 times