OpenXcom Forum

Modding => Released Mods => XPiratez => Topic started by: ivandogovich on April 07, 2016, 12:58:53 am

Title: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 07, 2016, 12:58:53 am
(https://i.imgur.com/TB01iD8.png)

The learning curve from OXC to XPirateZ is steep!  Trying to figure out how to get the best out of your gals, (especially in the early game) added to the huge variety of weapon types, can make your brain burn.  I tried setting up some spreadsheets to help me calculate which weapons benefited which gals the most.  I found this most useful for melee weapons because they stats they use can be so varied (bravery, reactions, melee, etc).

Then I got in touch with Imeryak to ask him for help pulling the data from my gals into an easy spreadsheet.  I could use this to import the stats into my analyzer.
Tool here: https://drive.google.com/open?id=0B3LA7DXD41YYQzdYVmRMRjRhN2M

Quote from: Imeryak
App grabs all soldiers from all bases, their names, missions, kills and current stats.
There are two buttons - one to open save files and one to save CSV files with soldiers stats. Those can be opened with almost any spreadsheet editor, including google docs.
To install - run setup.exe from publish folder or try sde\bin\Release\sde.exe to run it without installation.
Source code is included, so you may look at it and compile it yourself with Visual Studio 2013 Community Edition.
I am sure there will be bugs, so contact me when you find one.

Now on to the Squad analyzer.  We need to be able to define the weapon attributes (power, damage type, TUs, modifiers, etc).
Then we should have a sheet where the soldier's stats are matched against them allowing for analysis.  Such things as average expected damage (before armor), and maybe even maximum damage per turn?? (i.e. are 6 swings with a machete better than 3 with a cutlass?, etc).

I have a start of a google sheet that does some of this.  It has early game melee weapons, and sheets for the squaddies.  The Sheets call from the weapon sheet and compare them.  https://drive.google.com/open?id=1HvYn4zLRgPLozx0XUwmdb1WKPKxWFKINLP74wYks78U
Overall, I'm not convinced this is best format, but I'm putting it out here as a starting point. 

Spreadsheet gurus, data nerds, and creative thinkers are welcomed with open arms to this project!
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 07, 2016, 06:49:28 am
Ivan!! You cost me my evening!! Here's what I have:

https://docs.google.com/spreadsheets/d/1kyo9x_RGeVEer73qqgUxvgsqBcScuQRAcA5j09bhOqw/edit?usp=sharing

In theory, you could have a program/script which can write a csv for all weapons by parsing the ruleset, and all gals by parsing the save.

The only pain is implementing more weapons because of the way the spreadsheet tries to increment all references instead of just the proper ones, but.. you can write a script that does that too! (ie populate your csv).

So basically, with 3 scripts you should be able to:
1 - Get all weapons
2 - Get all gals
3 - Get a spreadsheet with how every gal does with every weapon

You can also write a script to:
4 - Get all units
5 - Get all armors
6 - Get a spreadsheet with how tough every unit in the game is
7 - Combine the gals & weapons spreadsheet with the units toughness one into THE ULTIMATE PIRATEZ SPREADSHEET!!! ... OF DOOOOM!! that allows you to see how all your gals would do with all weapons against all units. Obviously, that might be more data than an average brain can process... indeed, just seeing how gals do with all weapons is already quite a bit of data. This is why spreadsheets are not great analysis tools. Even Piratez breaks their ability to be really meaningful.

Navigating through the full list to see just the best weapon for a gal (or even worse, just the best weapon for a gal for a specific enemy) will be challenging. So..:
8 - write a parser for the ultimate piratez spreadsheet of doom that allows you to select a gal, a role (scout/grenadier/breacher/etc.) and a target, to spit out the best melee and ranged weapon.

Then you barely need to play the game.. and if Meridian integrates is in OXCE+, we'll get OXCE++ : the game that almost plays itself...
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: onionradish on April 07, 2016, 08:11:09 pm
You're right about the challenge in evaluating equipment options!

It's tough when you're starting out (like me) because you don't yet have experience with the new gear in use. I can see it getting even tougher as the game progresses and there are even more options to consider from captured gear and the black market -- plus a growing crew of gals.

I started some number-crunching earlier this week to help me decide starting gear. I'm using a rough, exploratory script in Python to read directly from the X-Piratez files and my save games. Reading from the files gives access to all the weapon damage stats and rules -- which can be pretty complex -- access to all the gal stats, and all equipment in bases, ships and equipped or carried by each gal.

Here's one example of rough results from that script using the "Ivana" gal stats from ivandogovich's spreadsheet for comparison:

Code: [Select]
--------------------
Saved game version: Extended 2.9+
Available weapons sorted by highest total damage
Weapon name: base_dmg + bonus_dmg + alter_dmg = total_dmg
Weights in square brackets

IVANA  [34]  (left: Smoke Grenade [-], right: Cutlass [7])
--------------------
bravery: 10, firing: 53, melee: 87, reactions: 65, strength: 34, throwing: 36
--------------------
Hammer: 60 + 43.1 + 0.0 = 103.1 [24]
Ax: 50 + 32.5 + 0 = 82.5 [12]
Cannonball: 80 + 0 + 0 = 80 [3]
Cutlass: 35 + 31.0 + 0.0 = 66.0 [7]
Ball Bat: 25 + 10.2 + 26.4 = 61.6 [7]
Launcher Grenade/HE: 60 + 0 + 0 = 60 [3]
Black Powder Bomb: 60 + 0 + 0 = 60 [4]
Rapier: 20 + 34.8 + 0 = 54.8 [6]
Short Sword: 25 + 29.5 + 0.0 = 54.5 [5]
Billhook: 40 + 13.2 + 0.0 = 53.2 [8]
Fistycuffs: 0 + 37.8 + 13.23 = 51.03 [3]
Harpoon Stun Bolts: 50 + 0 + 0 = 50 [3]
Flintlock Gas-Balls: 30 + 0 + 18.0 = 48.0 [2]
Boarding Gun Ammo: 46 + 0 + 0 = 46 [8]
Machete: 20 + 24.2 + 0.0 = 44.2 [3]
Dagger: 20 + 24.2 + 0 = 44.2 [3]
Handcannon Rounds: 44 + 0 + 0 = 44 [2]
Pipe: 15 + 20.4 + 0.0 = 35.4 [5]
Chainsaw: 35 + 0 + 0 = 35 [9]
Fuso Knives: 0 + 32.4 + 0.0 = 32.4 [4]
Assault Rifle Clip: 30 + 0 + 0 = 30 [3]
Flintlock Balls: 29 + 0 + 0 = 29 [2]
Banana Clip: 28 + 0 + 0 = 28 [3]
Blunderbuss Shells: 24 + 0 + 0 = 24 [3]
Handle: 10 + 10.8 + 3.12 = 23.92 [4]
Rope: 5 + 12.2 + 3.44 = 20.64 [4]
.8g Buckshot: 20 + 0 + 0 = 20 [2]
Molotov Cocktail: 20 + 0 + 0 = 20 [3]
Hunting Bow: 0 + 18.0 + 0.0 = 18.0 [6]
--------------------

Or a comparison of who is best at using a particular weapon (example melee and thrown):

Code: [Select]
Cutlass
Jazz: 74.2, Cable: 70.8, Jinx: 68.4, Shadow: 67.6, IVANA: 66.0, Bonzai: 65.8, Freefall: 63.8, Stalker: 61.0, Wardog: 60.6, Specter: 59.8, Pixie: 59.8, Zealot: 58.2, Sideswipe: 58.0, Saint: 57.6, Nova: 54.0, Renegade: 51.2, Luna: 48.2

Fuso Knives
Stalker: 53.1, Saint: 52.2, Renegade: 50.4, Wardog: 50.4, Cable: 49.5, Jazz: 46.8, Freefall: 41.4, Sideswipe: 41.4, Zealot: 41.4, Nova: 39.6, Jinx: 39.6, Pixie: 35.1, Shadow: 33.3, IVANA: 32.4, Luna: 29.7, Bonzai: 29.7, Specter: 28.8


From working with the stats, and poking through source code, here's what I see so far:

I've tried to parse the logic for the accuracy and damage calculations from the source code, but haven't got it completely figured out. There are some weapon stats that are sort of obscure, and I'm not completely sure I understand how all of them interact with a gal's skill stats. I'd welcome any details, info, or discussion on how accuracy and damage (of all types) is calculated -- especially for some of the unusual weapons.  ;)

EDIT: In many ways, I'd even prefer result output that's more a general recommendation for a gal, essentially taking the statstrings just one level further, not even showing the numbers: "Ivana is probably best with a melee weapon and would do well with MELEE_A or MELEE_B. As a secondary or alternative, consider GUN_A, GUN_B or THROWING_A." Some of the fun is in making the choices that suit your playstyle and experimenting with how it works in combat; for me, the main goal would just be to narrow the range of choices from dozens to a few.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 13, 2016, 05:00:26 pm
I started some number-crunching earlier this week to help me decide starting gear. I'm using a rough, exploratory script in Python to read directly from the X-Piratez files and my save games. Reading from the files gives access to all the weapon damage stats and rules -- which can be pretty complex -- access to all the gal stats, and all equipment in bases, ships and equipped or carried by each gal.

<snip>


I've tried to parse the logic for the accuracy and damage calculations from the source code, but haven't got it completely figured out. There are some weapon stats that are sort of obscure, and I'm not completely sure I understand how all of them interact with a gal's skill stats. I'd welcome any details, info, or discussion on how accuracy and damage (of all types) is calculated -- especially for some of the unusual weapons.  ;)

EDIT: In many ways, I'd even prefer result output that's more a general recommendation for a gal, essentially taking the statstrings just one level further, not even showing the numbers: "Ivana is probably best with a melee weapon and would do well with MELEE_A or MELEE_B. As a secondary or alternative, consider GUN_A, GUN_B or THROWING_A." Some of the fun is in making the choices that suit your playstyle and experimenting with how it works in combat; for me, the main goal would just be to narrow the range of choices from dozens to a few.

Great comments, analysis, and feedback!  Any help developing a tool to harvest the data from rulesets would be great!  I really like your idea for the "Recommended Weapons" as a nice final, simple product without all the number crunching.  I'm not really sure how to get there from here.  (Aside from building a complete utility program as a stand alone (X-Piratez Squad Util) and that is way beyond any programming ability I would have).  If we came up with a way to do so, it would still be good to have the more in depth information available for the number crunchers.

Let me get back to discussing some of your specific questions.

Quote
I've tried to parse the logic for the accuracy and damage calculations from the source code, but haven't got it completely figured out.

Some of the formula's are straight forward as you have noticed.  (Accuracy + (Melee*.5)), etc.  Others are exploiting a format that Yankes developed to add a ton more flexibility.  I'll see if I can parse it correctly, but at least you could follow up with Yankes if I can't explain it right.

From Yankes' OXCE Readme:

Code: [Select]
damageBonus: #used by ammo.
      #each bonus can be writen as: `s: x`, `s: [x]`, `s: [x, y]` or `s: [x, y, z]`.
      #where each value represents coefficient of polynomial `x * s + y * s^2 + z * s^3`.

As an example the Fuso knives use this as part of the accuracy modifier:

    accuracyMultiplier:
      firing: 0.0
      throwing: [0.0, 0.025]

I parsed this as :
(0 * Throwing) + (.025*(Throwing^2)

Overall, I think these open up the ability to change the curve of effectiveness as stats improve, but I'm not exactly sure.

Now, onto your question that you sent via message:  (and thanks, BTW!!)
Quote
Any thoughts on the kinds of info you'd want to see?

I think the average weapon analysis should include some of the following.
1. Total damage should indicate the Average Damage per swing.  (With 0-200% as the range, I've just left it as 100%).
2. There should be some consideration for likelihood of hitting.  20% chance to hit, vs 80% chance to hit is a big  difference.
3. Possible Damage Per Turn: (if you can expend all of your TUs for attacks, multiply your # of attacks (TUs/AttackCost) times the Average Damage per Attack.  This may make faster weapons more viable than slower, heavier hitting, ones (i.e. Machete vs Hammer on an unarmored target)
4. Should the Possible Damage Per Turn be multiplied by the likelihood? (i.e. * 80% hitchance, etc)?

Somethings along these lines would be nice for the number crunchers.

Am I making any sense? (I'm not sure) XD
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: yrizoud on April 13, 2016, 08:42:13 pm
IMO, the important part is that in the end, each gal has a "favorite" weapon that you can equip her with, and it's not a complete misuse of her skills.
Weapon speed must be taken into account. Since you're comparing 2 attacks of one weapon versus 4 attacks of another (for example), target armor must be taken into account : it's substracted 2 times in the first case, and 4 times in the second case. An arbitrary armor value must be chosen. Or if you like overkill, do one calculation for a mostly harmless opponent, one for a moderately armored, one for a heavy, and average the three.

For effective damage, I generally multiply all these things together :
1) %chance of hitting
2) %chance of doing ANY damage on hitting
3) average damage of the attacks which overcome armor
4) a factor depending on the practical number of attacks in a round

For melee attacks speed, 4 could be counted by assuming the girl spends 1/2 of her TUs getting to the target, and the rest attacking. Count the attacks she can make, keeping the decimals.


Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 13, 2016, 08:55:55 pm
 :o 

Yeah, I've pretty much tried to avoid the Armor side of things.  There are so many variables involved there, that we would really need to get into a "avg damage vs. Target A (i.e. Trader G.O.), avg damage vs. Target Q (i.e. Cyclops), avg damage vs. Target ZZ (i.e. Cyberdisc).  Because each of the resistances are so varied, it becomes mind boggling.

I think that by just focusing on what amount of damage they can put out in a single attack, you can get a sense of if "28 cutting" damage might hurt that unarmored vs. light armored vs. heavy armored dude.

I'm not saying that approach is wrong, I'm just not sure that it might blow the scope of this out of the water.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 13, 2016, 09:04:47 pm
No comments on my spreadsheet?  :-[

It already shows TUs, TUs/Attack (to get # of attacks/turn), chance to hit and damage applied given all the stat modifiers.

The avg/turn is # of attacks * % to hit * average damage
The max/turn is # of attacks * max damage (= you're hitting with every attack and rolling 200% damage for hit)

I think with these two you can a pretty good idea of what the weapons will do.

In this case, using Ivana as an example, you see that, of the weapons I entered, a rapier is the most reliable choice (because melee is good and strength not great), with cutlass a close second that could do more damage if you are lucky and get few misses (as shown by the cutlass' max damage being higher). Shooting wise, due to poor shooting accuracy, it's better to try to set her up for many rifle snap shots than anything else (and the sniper rifle is obviously a very poor choice).

As it is, the spreadsheet doesn't take armor into account (or armor piercing) but it would be doable. I picture it as a one value thing to set: You put a number in the armor cell and that is substracted from all damage. negative damage tells you that it won't do anything on average. Negative max damage that it won't ever do anything. The user can change the armor value depending on what they are interested in and see the effect.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 13, 2016, 09:11:23 pm
No comments on my spreadsheet?  :-[

Heh! I was just looking at it!  Looks great!  (Better than my sorry attempt!)
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 13, 2016, 09:17:04 pm
I think it should be possible to write something to properly populate it with weapons and formulas (I hate that dragging down formulas increments everything, instead of being able to determine which cell references should be.. ie no incrementing the cell references for the gal's stats)

Reading a ruleset in a proper table format shouldn't be too hard, but I've not programmed yet in a language that would be well suited for the task (and free sharing) :/ A python tool like Falko's would probably be the best.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 13, 2016, 09:22:34 pm
At a minimum, I'll probably tackle fleshing out the Weapons Table by hand at least for Melee weapons.  I think your sheets are strongest, so thats a great format.

I've some other Bootypedia projects first (Auxilliaries and Armor updates) so if someone can come up with a ruleset parser to grab weapon data before I get to it, that would be awesome. :)
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: yrizoud on April 13, 2016, 10:37:48 pm
(I hate that dragging down formulas increments everything, instead of being able to determine which cell references should be.. ie no incrementing the cell references for the gal's stats)
Sorry if I misunderstand or if you already know it, but Google Sheets lets you decide if your references are relative (the usual), or absolute (copying or dragging formula keeps the same row/column). It's the same syntax as in Excel, and the key F4 is a shortcut to toggle between all 4 possibilities :
=A1     <== relative in X and Y
=$A$1   <== absolute in X and Y
=$A1    <== relative in X, absolute in Y
=A$1    <== absolute in X, relative in Y
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 13, 2016, 11:40:49 pm
 :o

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

... (reconstitutes blown mind)

!!!!!!!!!!!!  ;D

Nope, I didn't know! I am not a spreadsheet user (besides pet projects like this), my work uses Matlab (which is not appropriate for this kind of stuff).

This is gold man.. GOLD!

I'm so happy I complained about this :D Thanks!
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: onionradish on April 14, 2016, 12:54:31 am
Great to see some discussion and ideas!

I've done some continued work on my script while playing and have finally figured out the source code damage calculations for weapons.

Currently, what I'm doing is stand-alone and uses Python to parse and process a save game file for gal/base/ship info against the core X-PirateZ data. I don't know whether or not similar capabilities could be integrated into existing capabilities of XcomUtil to show results in game or not. My thinking is that first we figure out the kinds of analysis we want, and then how to perform and present it. It would not be difficult to spit out a nice interactive HTML report for example, so anyone with design/aesthetic ideas should also chime in. CSV or other formats are also easy.

For each gal equipped with each available++ weapon, I can now calculate the average/baseline* potential damage directed towards an enemy's health, armor, stun, and other stats.

    * Potential damage ranges depend on the weapon's rules and/or the user's choice of UFO/TFTD damage method at the options level and are actually calculated in battle by RNG as a percentage of the baseline (0-2x, 0.5x-1.5x, etc.). Currently, I'm only calculating the baseline/average damage. I may later implement ranges so weapons with higher damage variability are distinct from those with more consistent damage.

    ++ Available weapons are considered a weapon that is is "seen" in bootypedia, is "in stock" at a base/craft, can be bought from black market, or manufactured. It's possible to sub-divide what's "available" as part of recommendation (for example, weapons you can't buy on the black market and have to manufacture could score differently).

My current script is not calculating accuracy or range, but I am investigating how that might work for recommendations. Accuracy/range and similar stats would obviously factor in to a "recommendation" on weapon. As an example, using an early game/gal save, the "Officer's Pistol" offers slightly less damage than the Flintlock, but the "OP" has higher accuracy and higher number of rounds loaded for similar TU and weight, etc. regardless of the gal's firing skill, which may make it a better overall choice.

I'm ignoring all real-time-battle-dependent effects (crouching, injury, morale, etc.). I'm not considering potential enemy type, armor or resistance. My thought for now is that those considerations are up to the player to decide or deal with as they occur. The "potential" seems like all that's possible to optimize, given that a particular target may or may not be armored, may or may not be resistant to a particular type of damage, etc.

From using the info while playing, I'm seeing that the need to evaluate the "best" weapon isn't all that frequent. Mostly it's helpful for figuring out what new recruits are good with and periodically checking after battles, research or other milestone to see whether something has changed.

The more ideas or formulas on how to calculate best/recommended weapon, the better -- please send them because they're easy to add to the script for discussion of the results!
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: R1dO on April 14, 2016, 12:59:52 am
Nope, I didn't know! I am not a spreadsheet user (besides pet projects like this), my work uses Matlab (which is not appropriate for this kind of stuff).

A multitude of different stat depended attack values vs a multitude of armor values and target health.
If that is not a recipe for a nice  surface  (https://www.mathworks.com/help/matlab/ref/trisurf.html) plot, what is? ;)
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 14, 2016, 01:14:41 am
Oh, sure, a nice plot of kill likelihood as a function of weapons and targets for a given gal? :D

But I meant in term of sharing the actual program and making something approachable ;)

Looks like onionradish is getting somewhere though!
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: onionradish on April 14, 2016, 04:42:44 pm
IMO, the important part is that in the end, each gal has a "favorite" weapon that you can equip her with, and it's not a complete misuse of her skills.

Weapon speed must be taken into account. Since you're comparing 2 attacks of one weapon versus 4 attacks of another (for example), target armor must be taken into account : it's substracted 2 times in the first case, and 4 times in the second case. An arbitrary armor value must be chosen. Or if you like overkill, do one calculation for a mostly harmless opponent, one for a moderately armored, one for a heavy, and average the three.

For effective damage, I generally multiply all these things together :
1) %chance of hitting
2) %chance of doing ANY damage on hitting
3) average damage of the attacks which overcome armor
4) a factor depending on the practical number of attacks in a round

For melee attacks speed, 4 could be counted by assuming the girl spends 1/2 of her TUs getting to the target, and the rest attacking. Count the attacks she can make, keeping the decimals.


I agree with the idea of getting to a "favorite" weapon and the practical number of attacks taking movement into account for melee.

If I'm understanding you on target armor, you're saying that the actual potential damage would need to be calculated after each hit, since most weapons do damage to armor so more damage from subsequent hits would get through the weakening armor? Also, why keep decimals on attack counts, in that fractional TU can't be used to attack in a turn? I'm interested in your ideas.


At a minimum, I'll probably tackle fleshing out the Weapons Table by hand at least for Melee weapons.  I think your sheets are strongest, so thats a great format.

I've some other Bootypedia projects first (Auxilliaries and Armor updates) so if someone can come up with a ruleset parser to grab weapon data before I get to it, that would be awesome. :)

I'm parsing the ruleset for all the weapon data so could give you that data in CSV if you want it for a spreadsheet. Tell me what you need. Also, thanks for the details on calculations, especially the polynomial one.


In this case, using Ivana as an example, you see that, of the weapons I entered, a rapier is the most reliable choice (because melee is good and strength not great), with cutlass a close second that could do more damage if you are lucky and get few misses (as shown by the cutlass' max damage being higher). Shooting wise, due to poor shooting accuracy, it's better to try to set her up for many rifle snap shots than anything else (and the sniper rifle is obviously a very poor choice).

One of the things that can be a surprise is how much each gal's stats can affect damage, especially for melee. And then how much accuracy can flip the table for potential damage.

Wardog  - Best Skill: Melee  [30]  (Left Hand: Cutlass [7], Right Hand: Fuso Knives [4])
--------------------
bravery: 20, firing: 51, health: 72, melee: 101, psiSkill: 0, psiStrength: 29, reactions: 73, stamina: 97, strength: 30, throwing: 56, tu: 76

* Cutlass               [  7]: 35  + 32.2 -> CUTTING     health: 67.2  armor: 6.7    stun: 16.8   
* Rapier              * [  6]: 20  + 40.4 -> CUTTING     health: 60.4  armor: 6.0    stun: 15.1   

max attacks per TU, (energy cost)
    --> max attacks * (weapon accuracy * melee/100) ==> hits * damage
cutlass     76 / 10 = 7, (7 * 6 = 42) -->  7 * (0.9 * 1.01)  ==> 6 * 67.2 = 403.2 avg dmg/turn
rapier      76 / 9 = 8, (8 * 7 = 56) -->  8 * (1.0 * 1.01)   ==> 8 * 60.4 = 483.2 avg dmg/turn


Freefall  - Best Skill: Firing  [63]  (Left Hand: Ax [12], Right Hand: Assault Rifle [8])
--------------------
bravery: 20, firing: 62, health: 74, melee: 39, psiSkill: 0, psiStrength: 33, reactions: 51, stamina: 75, strength: 63, throwing: 46, tu: 77

* Cutlass               [  7]: 35  + 33.0 -> CUTTING     health: 68.0  armor: 6.8    stun: 17.0   
* Rapier              * [  6]: 20  + 15.6 -> CUTTING     health: 35.6  armor: 3.6    stun: 8.9   

max attacks per TU, (energy cost)
    --> max attacks * (weapon accuracy * melee/100) ==> hits * damage
cutlass     77 / 10 = 7, (7 * 6 = 42) -->  7 * (0.9 * 0.39)  ==> 2 * 68.0 = 136 avg dmg/turn
rapier      77 / 9 = 8, (8 * 7 = 56) -->  8 * (1.0 * 0.39)   ==> 3 * 35.6 = 106.8 avg dmg/turn



The star to the right of the rapier means that the rapier isn't purchaseable from the black market. It has to be either captured from a battle or researched and then manufactured. At the early parts of the game, it may not be available to equip.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 14, 2016, 05:26:54 pm
I love what you are doing, and where you are going with this, Onionradish (though I admit, I'm not sure I completely understand it. XD).  It sounds like it truly has the opportunity to be an incredible tool!

Quote
I'm parsing the ruleset for all the weapon data so could give you that data in CSV if you want it for a spreadsheet. Tell me what you need.

I'm basically looking for information to populate this sheet:
https://docs.google.com/spreadsheets/d/1kyo9x_RGeVEer73qqgUxvgsqBcScuQRAcA5j09bhOqw/edit#gid=0

Arthanor created it and its a good base line.  There may be some additional columns necessary, (for additional effects (ie Morale damage, energy costs, etc.)

Thanks a Ton!

Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Yglorba on April 15, 2016, 01:06:09 am
Don't forget to include weapon size in the tables.  Sometimes you want a 1x1 backup weapon that can fit on your belt for going up against specific enemies.

(Although there's also the ammo expense or availability...  I mean, is it just going to tell me that the BFG is the best weapon for everything?)
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Arthanor on April 15, 2016, 04:47:52 am
hum... once you scale up your development, certain items drop off, of course and the choices may become more obvious. Like techblades being better than most melee weapons when you get them (unless your melee stat is terrible, I guess).

It might be possible to add sale prices as a column and normalize by that. So you can look at raw damage or damage/$$$? I'm not sure how otherwise..
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Yglorba on April 15, 2016, 10:03:40 am
I think the only real solution is to list all the top weapons for your situation sorted by average damage, and let the player pick from them.  There are too many variables to completely automate selecting a single best weapon.

There's considerations like clip size, reload time, size / weight of ammo, range, etc.  The best the algorithm can do is point people generally in the right direction rather than giving them a single clear "optimal" choice.

Like, it's gonna say that Fusion Torches are an amazing weapon against armored opponents early on, isn't it?  Because if you do manage to get next to someone at the start of your turn and use one, it has ridiculous damage output and perfect accuracy!  Unfortunately...  most tanks don't just sit there and let you get next to them with full TUs.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: onionradish on April 15, 2016, 08:19:46 pm
The potential damage for a gal/weapon combination can vary quite a bit because of the complexity of the stat modifiers, and it's not always obvious from reviewing the bootypedia which weapon might be "better" for a particular gal. The example above shows that simplifying to "Rapier is always better than Cutlass" isn't necessarily true. That non-obviousness caused my interest in looking into this.

My first goal is to develop a "squad damage calculator" that takes each gal's stats into account to report the possible damage she could deal with an "available" weapon towards an enemy's health/armor/stun. Damage calculations assume a hit, but include supplementary stats on likelihood of her having a successful hit, excluding battle-specific conditions (kneeling, range, enemy armor, etc.).

An "available" weapon is one that is in posession, can be purchased through the black market, or has been discovered through research (potentially manufacturable). Weapon availability obviously changes as the game progresses. That means that even if the BFG is the ultimate weapon, if it's not available, it won't be calculated or shown. Gals can only equip what's available.

From the output of the calculator, a player can choose what they think is the "best" PRIMARY weapon for a gal. The "best" weapon will vary over time based on changes in each gal's stats and what weapons are available.  Secondary weapons (the backup melee weapon for a gal skilled in Firing, etc.) can also be selected from the list, based on whatever makes sense to the player, considering weight limits, etc.

This calculator can also report which gals deliver more damage from a given weapon, so if you have a limited number of Axes (or BFGs), you can give them to the gals who can use them best first.  Melee weapons vary the most; many of the guns deal the same potential damage, with accuracy as the only differentiator.

The initial "squad damage calculator" is intended to expose all the stats for the player to choose from. Because of the variety of weapons available (which increases as the game progresses) and the range of gal stats (new recruits as well as experienced ones), some additional info is needed for the player in role of "COMMANDER" to make those choices. One of the potential negatives to exposing those stats is that it can lead to min-maxing (spoiling the fun of decision-making).

Once the stat calculator is complete, a secondary idea is to develop a "recommendation engine" that will take each gal's stats and weapon stats into account to suggest a shortlist of available weapons suitable for that gal. That's where size, ammo capacity, accuracy, TU, weight and other considerations come into play, and where items would get filtered out.

I think there is some fun to player choice and assignment of a "favorite" weapon even if it isn't the best statistically. A recommendation engine would have to take the available weapons, gals, and other factors into account to suggest a shortlist of weapons for a gal, while still offering some choice. It's a potential "next step" after the stat calculator is done and may or may not be necessary or wanted. The choice of "best" weapon goes beyond stats into opinion and philosophy, so we'll see what shakes out once we have some stats to consider.

Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Eddie on April 17, 2016, 05:39:26 pm
My opinion is that weapon choice depends alot on your target. Things like the poison knive give you totally wrong damage values if you don't account for target armor.
I've attached the spreadsheet that I use for melee. It considers target armor and damage modifiers. You can play around with it if you like.

Edit: Updated spreadsheet, had wrong numbers for the leather whip.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: onionradish on April 19, 2016, 11:15:37 pm
I've got accuracy calculations working now, but need to clean up the code and need to combine "weapons" which are responsible for accuracy based on the gal's stats plus type of action (snap, auto, aimed, etc.) with the "ammo" for the weapon (may be multiple types) which are responsible for raw potential damage so they can be presented/evaluated together. This is easy for melee which has no ammo, but ranged weapons get complicated.  :o

From using the rough output for my own very early game (April, year one, 28 hands), I see the need for lots of optional filters for the output. The list of potential weapons+ammo gets ridiculous quickly as research/capture reveals more potential weapons and the number of hands increases.

What kinds of "filter" criteria would be useful? Basically, for which gals would you want to see a report on possible/best weapons? Options can be customizable and combined -- I just need to add the capability before the tool is shared for use. For example:


Let me know what you'd want to see and when/how you might use analysis output. I'm finding that I most want to use the analysis for newbies (always), and only periodically for experienced gals depending on how their stats have changed or what research/capture has unlocked.

I'm also seeing potential value in accounting for "available weight" based on the armor equipped. Even if a hammer does more damage, if I can't wield it with my equipped basic armor plus beer and bandages, I don't want to see it.

Finally, for a tool like this, are you able or willing to run a Python script or would you want/need something else? I can compile it to an EXE, but that only works for Windows and might seem suspicious since it's not obvious what it does.

Calculations based on # hits versus an armored targed (given gal accuracy, TU, enemy armor, etc.) to show actual "received" damage (not just what was "delivered" based on weapon, ammo, gal, action) are entirely do-able, but will come later.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: ivandogovich on April 19, 2016, 11:32:55 pm
 :o  The array of possibilities, is indeed, almost overwhelming.   

Generally, I'd agree that its is very helpful early with raw troops as the differences in their skills make a significant difference.

Of the possible filters that you mentioned,
Rank: would be able to screen newbies,
Assigned to Craft: (From items on the craft).  This way you could even run the tool from a save before touching down at a tactical mission.
Best Skill: Nice to have, but maybe not critical.
All known: Some weapons may be out of reach (lack of parts, etc) but it could reveal an otherwise overlooked great matchup. (again, nice to have, but not critical?)
Non-injured could be good too. :)

Yeah, dealing with weight gets complex too, because, if you start swapping armors around, the options change considerably. :/  Not sure its critical.

As for script vs. .exe:  I'm not sure what is required to run a python script, perse.  I'm fine with an executable, 'cuz I'm a windows guy.  More important is the output.  A decent data table can be consumed by other tools to continue the analysis, I suppose.  This, rather than output only to the screen is what I'm thinking.

I may be thinking too narrowly, or don't have the scope of the possible here. 
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: legionof1 on April 19, 2016, 11:40:24 pm
My preference for filters would be something "Job" oriented. Finding the ideal weapon for a given task be it heavy support like HMG, or best rifle, CQC, etc. Then find gals who can do x within a certain tolerance. Oh noes im 2 str away from carrying the HMG and ammo. Big deal, do the job.
Title: Re: XPirateZ Squad Analyzer (Help Wanted)
Post by: Yglorba on April 21, 2016, 11:49:17 am
A filter for weapon size would be nice.  It can be useful to give your gals backup weapons specialized against specific kinds of enemies, but you'll often want to be able to fit those in your quickdraw or belt slots for easy access; if you have to put them in your backpack, drawing them takes more TU.