FightOptimizer.ash

[quote author=Alexander Daychilde link=topic=983.msg4926#msg4926 date=1182502322]
** no need to quote images **
[/quote]

oops...Makes a mental note to not post and go. I intended to remove the image tags, forgot.

** no need to apologize ;-) -Daychilde (forgot to sign the others) **

[quote author=angeredtsuzuki link=topic=983.msg4929#msg4929 date=1182539400]
Damn Gremlins!
it did it again after i re-dl-ed it for the 10th time!
[/quote]

I could go on for quite a while with suggestions like maybe a bad sector on your Hard drive? How about trying the newer Daily build?
 

muffins

Member
I initially came here to ask a question about how strategies were prioritized... but the script answered it for me with the DEBUG_SIMULATOR option. :eek:

I seriously, seriously love this script, and I think I'll love it even more once I (finally) pick up a healing skill this run. The information junkie in me is pleased. Kudos and Congo Rats to you!

Edit: Hmm, I was testing it out in the Ninja Snowmen's location, just for information/background's sake, I've got all Sauceror skills, some TT, some PM, some SC.

I was testing it without defaultAutoAttack set and without Fusilli, and it was selecting Saucestorm to beat the mobs (<3 the DEBUG_SIMULATOR option, I thought Stream x2 would be cheaper, guess not, also, see above: love this script!).

I just tried it with the defaultAutoAttack option set to Stream of Sauce, and it didn't appear to update the monster's HP, and continued to use Saucestorm, even though a single SoS would have taken it down at that point.

So... point being, it doesn't seem to take into account (modify the monster's HP) defaultAutoAttack damage before calculating the strategy. I'm too afraid to fix this myself, 'cause I know I'd end up breaking something else. :-[
 
[quote author=muffins link=topic=983.msg4937#msg4937 date=1182672845]
So... point being, it doesn't seem to take into account (modify the monster's HP) defaultAutoAttack damage before calculating the strategy. I'm too afraid to fix this myself, 'cause I know I'd end up breaking something else. :-[
[/quote]

Yeah, it doesn't. That would be a nice thing to add ... I kind of punted on it for the first version since it's just as easy to leave defaultAutoAttack off. I'm glad you found the debug features of some help!

It's funny -- I actually just rewrote the damage parser to be a lot more robust while I was waiting for the NS13 rollover, but pheeeww... given the way so many skills were changed (low-level spells? TS/LTS? aiee!!) and the sheer quantity of new items and monsters and stuff, it'll be a while before this script does anything right again. ;D But on the bright side, once everything is spaded out it'll probably be even more useful than it was before, since it seems like combat has gotten significantly more complex.

I'll see if I can get an update posted in 24-48 hours once the basic parameters of the new changes have been settled upon in the wiki.

[quote author=kain link=topic=983.msg4928#msg4928 date=1182536631]
The only thing I'm running into is when I'm trying to open the library and I'm wielding the pool cue, it tries to thrust-smack and of course, if you have spirit of rigatoni perm'd ... that's a crapshoot!
[/quote]

Hm, yeah, I'll have to check that out. Thanks!
 

muffins

Member
[quote author=Harry Crimboween link=topic=983.msg4947#msg4947 date=1182760787]
Yeah, it doesn't. That would be a nice thing to add ... I kind of punted on it for the first version since it's just as easy to leave defaultAutoAttack off. I'm glad you found the debug features of some help!

It's funny -- I actually just rewrote the damage parser to be a lot more robust while I was waiting for the NS13 rollover, but pheeeww... given the way so many skills were changed (low-level spells? TS/LTS? aiee!!) and the sheer quantity of new items and monsters and stuff, it'll be a while before this script does anything right again. ;D But on the bright side, once everything is spaded out it'll probably be even more useful than it was before, since it seems like combat has gotten significantly more complex.

I'll see if I can get an update posted in 24-48 hours once the basic parameters of the new changes have been settled upon in the wiki.[/quote]

Yeah, I kinda figured either that or you just didn't wanna bother adding things before NS13, which is completely understandable.

I know what you mean about all the skill changes... my poor sauce spells (I have every Sauceror skill HC perm'd... yes, I am insane) have definitely undergone some nerfage!

Well, here's to the spades. May they be as lag free as possible in their data-gathering (ad)ventures! :D
 
I've just updated the script (still in the first post of this thread) with support for the NS13 changes.

A couple of things to say:
* NS13 changed more than anybody expected, so ALL THE FORMULAS IN THE SCRIPT ARE PROBABLY WRONG NOW. ;D Even so, I've added at least early support for spell damage caps, chefstaff multipliers, and adjusted the TS/LTS hit percentages. Anything that's not explicitly stated in-game is just my own personal wild-ass guess.
* There's a whole lot of new equipment with new effects that the script doesn't know about. I added the known chefstaves and a tiny handful of other stuff, but it'll be a while before everything new is built into the script again.
* It also makes a very pessimistic assumption if it encounters a new, unspaded monster that KoLmafia doesn't yet know about. (It guesses that it's ML 200, so don't be surprised if it breaks out the big guns... I did this because in practice I found the level 11 quest monsters to be about 150ish and the level 12 quest monsters to be up to 200ish.)
* I've rewritten the damage parser to be a bit more robust and made a few other smaller changes.

In short, it's highly experimental, and will sometimes just fail, but at least it's better than the old version at dealing with the post-NS13 world. I'll continue updating every few days as things are spaded out. I'd recommend using the latest KoLmafia build you can get your hands on for the time being.
 

muffins

Member
Nice work on adding the caps for Sauceror spells!

I can go ahead and verify that the formulas HAVE changed for sauce spells. It's estimating that it already hit the damage cap, even though I'm doing less than the cap. For the time being, I'm adjusting the cap as I go, using pessimistic values to keep with the nature of the script, but I suck at math now, so I can't really help in calculating the formula.
 
[quote author=muffins link=topic=983.msg4982#msg4982 date=1182958056]
I can go ahead and verify that the formulas HAVE changed for sauce spells. It's estimating that it already hit the damage cap, even though I'm doing less than the cap.[/quote]

Yeah, please do tweak the formulas to fit the results that you're getting and make it work for you -- like I said, everything has changed. It's also entirely possible that the cap adjusts according to your level or myst, and maybe even with your current class. I've mostly been testing with a well-equipped level 11+ Sauceror (not enough time in the day to play multis right now) so what works for me may be totally broken for someone else.

I'm posting a 1.0.3 version of the script now which has a bunch of monster element overrides and handles dual-wielding of chefstaves correctly. (Dual-wielding the cold chefstaff against a sleaze/stench monster is pretty wicked... I just did 2500+ damage with a Saucegeyser. :eek:)
 

muffins

Member
[quote author=Harry Crimboween link=topic=983.msg4983#msg4983 date=1182970902]I'm posting a 1.0.3 version of the script now which has a bunch of monster element overrides and handles dual-wielding of chefstaves correctly. (Dual-wielding the cold chefstaff against a sleaze/stench monster is pretty wicked... I just did 2500+ damage with a Saucegeyser. :eek:)[/quote]

*sob* Of course, now they give the Sauceror even more kickass items... when I started out in getting all their skills, they were my least favourite class... now I feel lost without my MMJ and kickback cookbook and... well, now things I didn't even have! I would say this means it's time for another Pasta ascension, but it seems kinda pointless if you can't use the skill/items at all in hardcore without being one of those two classes, so... blah! Oh well, gives me something to look forward to, eventually.

Anyway, back on topic, yeah, my buffed myst isn't even quite to 100 yet (Seal Clubber run), so I'm having to do extremely basic manual adjustments to the formula, like -10 to the end of the Storm and Wave calculations, heh. It's working so far, and I'm getting an idea of what to expect by regexing my session logs and posting just the damage values into Excel and... *ahem* yeah... I'm a geek! ^_^

Hmm, I wonder if it'd be possible to include current stats between adventures in the session log, like in XX/XX/XX format. As I said, I wouldn't be able to figure out the formula, but anyone who could with that data would be welcome to my session logs! ;)
 

fewyn

Administrator
Staff member
Hmm... You might want to put something in so it doesn't attempt to use skills under the effect "Temporary Amnesia".. I bet there's other effects like that too but can't remember any off the top of my head.
 
[quote author=fewyn link=topic=983.msg5005#msg5005 date=1183055831]
Hmm... You might want to put something in so it doesn't attempt to use skills under the effect "Temporary Amnesia".. I bet there's other effects like that too but can't remember any off the top of my head.
[/quote]

Forgot about that one. (ba-dum-bum) No, seriously. :) It actually does check for some sometimes-skill-blockers like Cunctatitis and the Bonerdagon. Temporary Amnesia is a bit stronger, though. You're right -- it definitely shouldn't try to use any skills when under that effect. I'll fix it in the next update. Thanks!

If you run into others please let me know.
I've posted 1.0.4, which tries to model spell backlash damage for non-Myst classes (I suppose they're not as good at controlling the magic). I've also added in a handful of monster HP overrides for the Arid Extra-Dry Desert and Black Forest.

FYI, I'm thinking about having the script auto-spade new monsters so that it can accelerate the whole process ... it wouldn't be hard to auto-spade the HP and monster element, anyway.


Oh, and as promised it should avoid skills when you have Temporary Amnesia.
 

Veracity

Developer
Staff member
[quote author=Harry Crimboween link=topic=983.msg5023#msg5023 date=1183216309]
FYI, I'm thinking about having the script auto-spade new monsters so that it can accelerate the whole process ... it wouldn't be hard to auto-spade the HP and monster element, anyway.[/quote]

That would help. Otherwise, I depend on Kittiwake to update his Monster Survival Guide with the data.

I may or may not put in the monsters for other new areas soon. I am reaching my limit of how much time I want to spend adding the new content to KoLmafia, and will probably take a break, soon. :-\
 

fewyn

Administrator
Staff member
Is there anyway to get it to ignore using skills? Such as lts and attack? It seems it keeps thinking I can hit with attack but I keep failing.
 

kain

Member
[quote author=Veracity link=topic=983.msg5024#msg5024 date=1183220751]
That would help. Otherwise, I depend on Kittiwake to update his Monster Survival Guide with the data.

I may or may not put in the monsters for other new areas soon. I am reaching my limit of how much time I want to spend adding the new content to KoLmafia, and will probably take a break, soon. :-\
[/quote]
I'm not sure how relevant it would be, but I think that picklish's recipe script auto-yanks the info from the wiki. I don't know if something could be setup (and sadly, I wouldn't have a clue how to do so) to yank the numbers from the wiki on monsters/stats/etc
 
[quote author=fewyn link=topic=983.msg5070#msg5070 date=1183352456]
Is there anyway to get it to ignore using skills? Such as lts and attack? It seems it keeps thinking I can hit with attack but I keep failing.
[/quote]

To ignore any skill, including passive skills, look for the "skill_simulate" and "skill_ignore" maps and add the skill to the ignore map. (Simulating skills is obviously not very useful in-game, but I use it occasionally during testing.) Something like this:

skill_ignore[LTS] = true;

To remove attacks from consideration, look for the "action_map" map and comment out the line for "attack".

I think with NS13 some of the monsters in (what used to be) the higher-level areas have been amped up to be just a few points harder, so KoLmafia's internal database may be slightly off. It'll take time to really know for sure though.

Also, you may have better luck with 1.0.5 and attacks. The script will sometimes attack as long as it has an over 50% hit rate -- which means that it misses sometimes, but it should take that into account. Earlier versions didn't reassess the cost of the strategy after attacking and missing, but the new 1.0.5 that I'm about to post does a better job of adjusting its strategy after a failed attack.
[quote author=Veracity link=topic=983.msg5024#msg5024 date=1183220751]That would help. Otherwise, I depend on Kittiwake to update his Monster Survival Guide with the data.

I may or may not put in the monsters for other new areas soon. I am reaching my limit of how much time I want to spend adding the new content to KoLmafia, and will probably take a break, soon. :-\
[/quote]

Well, you've been doing a great job so far. :) Thanks for all your hard work!

I've just posted FO 1.0.5 with auto-spading of HP. There are two settings - normal autospade and aggressive autospade. If you autospade normally, the script will simply record the damage done to various monsters so that it gets an upper and lower bound. If you autospade aggressively, the script will not worry so much about MP/HP/meat expenditure and just try to find a strategy that will uncover more information about the monster.

I've also added some support for the rampaging adding machine in the Orc Chasm. (Just found out about that one, geez.) It can't really know if you've finished the quest or not, so it just goes by your inventory -- if you don't have a 64735 scroll, it'll try to make that, otherwise it'll go for a 31337 scroll.

[modbreak=Please don't double post]There's a "modify" button/link you can use. :) - Daychilde[/modbreak]
 

fewyn

Administrator
Staff member
[quote author=Harry Crimboween link=topic=983.msg5081#msg5081 date=1183410636]


Well, you've been doing a great job so far. :) Thanks for all your hard work!

I've just posted FO 1.0.5 with auto-spading of HP. There are two settings - normal autospade and aggressive autospade. If you autospade normally, the script will simply record the damage done to various monsters so that it gets an upper and lower bound. If you autospade aggressively, the script will not worry so much about MP/HP/meat expenditure and just try to find a strategy that will uncover more information about the monster.

I've also added some support for the rampaging adding machine in the Orc Chasm. (Just found out about that one, geez.) It can't really know if you've finished the quest or not, so it just goes by your inventory -- if you don't have a 64735 scroll, it'll try to make that, otherwise it'll go for a 31337 scroll.
[/quote]

Awesomeness :D I'll be using the aggressive autospade on my softcore characters as I push them up through the levels so we get a better idea :D Thanks
Gotta say, I've been using the autospade functions and they are working beautifully so far. Good job :D

[modbreak=Please don't double post]There's a "modify" button/link you can use. :) - Daychilde[/modbreak]
 

Nightmist

Member
Just here to verify that I'm understanding this script correctly. I'll write up what I think happens in a numbered list.

1. Brute Force every single possible mix of actions for the first 3 rounds (1-3).
1(a). In the event of expected death before 3 rounds then stop that particular branch to save computing time.
1(b). Remove any entries that extend for over 3 rounds.
1(c). If all combat strats extends for over 3 rounds then throw a abort error?

2. Find the Meat cost for the remaining mix of actions (actions that cause death of monster within 3 turns).
2(a). Meat cost is based off expected HP/MP losses.

3. Find the lowest Meat cost of using these actions.
3(a i). In the event of tied costs then the shortest path is taken.
3(a ii). In the event they are tied and of the same cost then the first found "winning" strat is kept and the new one is dropped.

4. Use the first action of the winning strat in a single round of combat.

5. Take the response from the action taken then update the strat accordingly (if set to update the strat mid-battle).
5(a). If not set to update mid-battle then run the next action.
5(b). The updated search for the strat works for the next 3 rounds (2-4) and work under the same assumptions as 1 and is effectively a loop of 1-5.
 
[quote author=Nightmist link=topic=983.msg5089#msg5089 date=1183540520]
1. Brute Force every single possible mix of actions for the first 3 rounds (1-3).
1(a). In the event of expected death before 3 rounds then stop that particular branch to save computing time.
1(b). Remove any entries that extend for over 3 rounds.
1(c). If all combat strats extends for over 3 rounds then throw a abort error?
[/quote]

Glad to see someone taking a closer look. :) That's pretty close. It has a couple of special initial actions (steal, Entangling Noodles) which it treats as special, so it really kind of checks 1+3 actions deep.

Just like a KoLmafia custom combat script, the simulator (and, later, the strategy executor) will loop on the last action until the battle ends with victory or defeat. So it doesn't actually need it to cause death within 3 rounds -- it just needs to settle down so that the last action can be repeated to beat the monster. For example, if you have high moxie but a low-damage attack, the script could find "Disco Face-Stab, attack" as a strategy even if it takes 15 rounds of attacks to whittle away the monster's HP.

Pruning the search tree is very important to keep it running fast. While it's searching it keeps track of the lowest-cost winning strategy that it's found. As it's simulating it may cut a simulation short (and prune that whole branch of the search tree) if it's clear that everything in the branch will be more expensive than that lowest cost. That's when the "getting too expensive" debug message is shown. For example, if it knows "Entangling Noodles, Stream of Sauce, Stream of Sauce" at 9MP is a working strategy, then it will not bother to explore "Weapon of the Pastalord" plus anything because it can see that the MP cost of WotP immediately makes that whole branch more expensive.

The pruning is enhanced by sorting the actions by MP cost, and iterating over them from lowest-cost to highest-cost. If it considered the actions in random order with a simple foreach, it would still get the same answer, but it'd start out finding a poor strategy at first and then refine it to better strategies later. So it would prune less and ultimately search a lot more of the tree, which means it'd be a lot slower.

[quote author=Nightmist link=topic=983.msg5089#msg5089 date=1183540520]
2. Find the Meat cost for the remaining mix of actions (actions that cause death of monster within 3 turns).
2(a). Meat cost is based off expected HP/MP losses.

3. Find the lowest Meat cost of using these actions.
3(a i). In the event of tied costs then the shortest path is taken.
3(a ii). In the event they are tied and of the same cost then the first found "winning" strat is kept and the new one is dropped.

4. Use the first action of the winning strat in a single round of combat.

5. Take the response from the action taken then update the strat accordingly (if set to update the strat mid-battle).
5(a). If not set to update mid-battle then run the next action.
5(b). The updated search for the strat works for the next 3 rounds (2-4) and work under the same assumptions as 1 and is effectively a loop of 1-5.
[/quote]

Yup. So at every round it's looking 3 actions deep ... however, since it will loop the last action it can actually go more than 3 rounds deep in the simulation. I've tried having it search 4 actions deep but it didn't really help in most situations. It might make some sense for Disco Bandit combos, but otherwise looping on the last action is usually sufficient.

For the second and later rounds, it already knows its old strategy is probably pretty good. So it compares every candidate against that strategy's cost, which again usually leads to a lot of pruning and a fast search.

The code isn't super-clean everywhere -- there's a lot of it, and there are some vestiges of different approaches that I tried and abandoned scattered in there. It's kind of overdue for a total rewrite at some point once the NS13 dust has settled.
 

macman104

Member
[quote author=Harry Crimboween link=topic=983.msg5091#msg5091 date=1183581898]The code isn't super-clean everywhere -- there's a lot of it[/quote]Regardless, I very much like the amount of commenting you did. It appears quite clean to me, and it's easy to follow.
 

fewyn

Administrator
Staff member
Sadly the latest SVN copy of mafia has completely broken the script :( (Revision: 4224)


I'm getting an error "Start greater than end and increment greater than 0"
 
Top