Snake Sneak
Posts: 109
Joined: Wednesday, 2nd February 2011, 03:20
Lua scripted "bots"
Right now they're pretty simple. This thread isn't really about the coding or anything, just a general thread about them, about any questions people may have, and also because I'm working on one and want some ideas for it. (and I thought it would fit in a design forum better than the general forum)
If you want to try out the bots yourself, these are the three that I'm aware of:
elliptic's (autorobin):
http://crawl.akrasiac.org/rcfiles/crawl ... torobin.rc
N78291's (xw):
http://crawl.akrasiac.org/rcfiles/crawl-git/xw.rc
mine (auto7hm):
http://crawl.akrasiac.org/rcfiles/crawl-git/auto7hm.rc
To actually use them, you copy the rc file contents into your init.txt file. The messages on mine and elliptic's bot (not sure about xw) are muted to make playing on cao more of a clean look - so change the following line:
message_colour = mute:.*
to
message_colour = mute:
so that you can read messages (or don't, your call)
After copying the rc file over, you start (and run) the bot by creating a macro within crawl itself.
the trigger key should be "d"
the macro action should be
(for mine) "===start_autoplay" or (for elliptic's) "===s" or (for N78291's) "===a"
After that the bot will basically run itself. The three bots act differently. Elliptic's and N78291's are by far more successful and bot have some rudimentary item identification. They can clear Lair and make headway into orc, and with player intervention can get really good speeds and have some modicum of success. As an example, phybot was run using an early version of elliptic's rc and... "121. phybot the Eviscerator (L20 FeBe), worshipper of Trog, shot by a yaktaur (runed bolt) (led by a yaktaur captain) on D:25 on 2011-03-23, with 268493 points after 71102 turns and 2:05:57."
Mine works a little bit different, in that none of the monsters are special-cased in the bot itself. It learns monster difficulty / danger based on past experience, by tracking a couple stats, creating a table to store monster data, and occasionally pushing the table into the chardump notes, so that I can copy it over multiple games and have the bot learn over a longer period of time.
If you're interested in this stuff or know lua (or want to screw around with lua) then you can basically just edit any of these rc files and adjust things to your heart's content. Or just start over. All these bots are based off of autofight.lua and go from there. If you have questions you can ask here or on IRC and I'll (and I'm sure others) will do their best to help. If you have ideas for further improvements to the bots, those are also appreciated by me at least.
....
Now on to my own bot and some help that I need with it.
I wasn't sure what data to learn about each monster. I'm limited a bit by the lua hooks available and can't tell which monster actually hit me, so right now it tracks the following data.
Monster Name / Times Seen / Melee Damage / Ranged Damage / Dungeon Level
1) Monster name is obvious.
2) Times seen isn't. It refers to the total number of turns that monster of that type are in LOS - not how many times each individual monster is seen. (If two monsters of the same type are in LOS, it increases by 2 each turn. If 3, by 3, etc.)
3) Melee Damage refers to amount of damage done (not neccesarily by this monster) while the monster was in melee range. This is an imperfect number for two reasons. A) It could represent damage that you took from a different source and b) it could represent damage done while the monster wasn't actually beside you. But it's an approximate value so it's good enough.
4) Ranged damage is similar to melee but refers to damage done while the monster isn't in LOS. This suffers from similar drawbacks, but it also assigns a danger level to monsters like giant eyeballs and orc priests.
5) Dungeon level is a cumulative stat that refers to the absolute dungeon level you are on when you see each monster. So if I see a rat on D:1, I add one to this stat. If I see a rat on D:3, I add 3. Etc. When you take DL / Time Seen you get an approximate difficulty level based on spawning depth. Not perfect, but over time it should be pretty good.
So that's the info I'm collecting. I'm also collecting status info (but not storing it past the turn) such as distance (is the monster in melee range), status effects (is the monster confused, sleeping, etc) that could be used to assess danger level. My issue is that the danger assessment I've got right now is garbage. It's convoluted and it doesn't address actual danger level (though it does have funny consequences, such as the bot freaking out a couple games ago whenever he saw hobgoblins, and not worrying about ogres).
Does anyone have any suggestions for how I could take that data and create some kind of effective danger assessment?
(I'm also basing danger on non-monster factors of course, such as HP, whether or not I can berserk, cumulative monster danger (for when there are multiple monsters in LOS), etc.)