Greetings, one and all.
There's one thing stats makers dread over all other things: balancing. It's annoying, because it's not hard
, but it does take a lot of time. You have anywhere from 8 to 12 different attack fleets, each with potentially different defense ships, and ideally, you'd like to compare each fleet's strength against every other fleet's. That's 64 to 144 bcalcs, some with variations, all to be created manually. In addition, the PA server doesn't really like changing
stats, so you regularly need to ask Appocomaster to reset the beta server to avoid messing up your bcalcs. And then you do this half a dozen times...
All in all, it's no fun.
Attempt number one
A bit over a year ago, I wrote a stats balancing tool to try and smoothe out this process. However, its shortcomings quickly became apparent. It used a number of heuristics to make its decisions. Some of these were 'EMP can never beat Terran ships' and 'Ships with better inits always beat ships with worse inits'. These were reasonable approximations, but every time, it would make a couple of mistakes. If every time you use a tool, you have to double check whether it got it right, then that's not a very useful tool.
Attempt number two
Needless to say, I quickly stopped using my stats balancer, and voiced my intent to do a proper, exact calculation, pitting every fleet against every other fleet in a real battle. This seemed fairly simple at first, but I had some trouble figuring out an elegant way of implementing a full battle calculator, and after a couple of days of getting stuck, I moved onto pastures new.
Fortunately, I found some free time this year, got bored, and found a method to implement it. As regulars of SD know, I've been using that tool for the last couple of rounds, and I'm finally happy enough with it to release it into the wild:
(Because nothing says 'humble' like naming stuff after yourself.)
My assumption is that people who use Windows do not have a compiler handy. People who use Linux should read INSTALL.
mzCalc depends on mzLogger and (for the tests) mzTest, both of which are also covered by GPLv2. These are statically linked into the Windows build, and their source code is provided as part of the source code package above.
mzCalc, mzLogger and mzTest depend on Cygwin to run on Windows. I suspect non-Cygwin Windows compatibility would be easy to add, but I have not done so. Several Cygwin DLLs are therefore included in the Windows build as a matter of convenience. These are covered by LGPLv3 and the source code can be found here
The main goal of mzCalc is to perform a detailed analysis of a set of stats. The way you use it is by copying a set of stats from the PA server (for example, here
), pasting it into a text file, and then run mzCalc on it. mzCalc will look at the stats, try to figure out what fleets people will build, and then pit those fleets against each other. It then applies a formula to the losses on both sides, and determines whether the attacker would ever want to launch. If not, the defender is immune, otherwise, vulnerable.
mzCalc may get the fleet compositions wrong. It may contain multiple ships targetting the same class, or target certain classes too heavily or too lightly. In order to allow manual correction, mzCalc can be run in two steps. First you generate fleet compositions, which you can write to a file that you can manually edit. Then you can run the analysis on the modified fleet compositions, and get a much more realistic outcome.
The application runs on the command line: cmd.exe on Windows and any terminal emulator on Linux.
OK, so let's do that.
Grab mzCalc and extract it. Pick up Paisley's stats and paste them into a text file called 'r69-paisley-stats.txt', saved in the same directory as mzCalc. Then run it as follows:
mzCalc.exe --export --stats r69-paisley-stats.txt > r69-paisley-fleets.txt
This tells mzCalc to read the stats from r69-paisley-stats.txt and to export the fleet compositions to r69-paisley-fleets.txt. This file contains the fleets mzCalc has decided on. You should check these using your favourite text editor. (Odds are Notepad will display the file incorrectly, though.) The numbers are the amount of resources each planet spends on that ship, out of a total of 100M.
Once you're satisfied that the fleets are correct, run mzCalc again, this time as follows:
mzCalc.exe --analyze --stats r69-paisley-stats.txt --import r69-paisley-fleets.txt --verbose Error
This tells mzCalc to (once again) read the stats from r69-paisley-stats.txt, to read fleet compositions from r69-paisley-fleets.txt, and to write the outcome to r69-paisley-outcome.txt. You can now look at this file to see what mzCalc thinks. The output will be rather succinct. To get more or less information, replace 'Error' with: Warning (same info with vulnerability score), Info (= Warning + show value losses), Debug (= Info + show full breps), Trace (you probably don't want this) or None (idem). I usually use 'Error', though.
In addition to performing full stats analysis, you can run a single bcalc by giving the ships on the command line. For example:
mzCalc.exe --calculate --resource-theft --stats r69-paisley3-stats.txt Fleet 160000 130000 1000 Pegasus 100 Demeter 100 Cyclops vs Fleet 120000 100000 3000 Fireblade 300 Asteroid 1000000 Resource Fleet 120000 100000 2000 Fireblade
This will pit a fleet of 1000 Pegasus, 100 Demeter (pods) and 100 Cyclops (resource stealers) against a planet with 3000 Fireblade, 300 roids and 1m resources that has received a defense fleet containing 2000 Fireblade defense. The other large numbers are planet score and value, respectively. Note the use of --resource-theft: without that, resource stealing is disabled.
I think that's all. Let me know if you run into any problems. Suggestions and feature requests welcome (though I make no promises).