Calculating Average Damage

Pages: 1
NathanKell
12/07/01 09:08 PM
24.44.238.206

Edit Reply Quote Quick Reply
This post is mostly intended for programmers, but feel free to jump in, no matter your area (or level) of knowledge.
English Majors, you've been warned. ;)

This surfeit of statisctics had prompted me to write--well, script--an Excel [spreadsheet] file to calculate (and compare) average damage at a given range for a given number of mechs (and thus weapons configurations and heat sinks). However, my knowledge of Excel is limited enough (or, the program itself is limited enough) to make a nice plug-and-play calculator quite difficult if not impossible. The problem is that the weapon list, not to mention the mech list, must be scalable, and thus the pick-the-best damage/heat weapon per range if function must scale. I've thus decided to brush off my (C++) programming knowledge and apply it (for once).

Anyway, the point of this post is a question: has this been done before?
If not, any bright ideas? Or shall I do this the brute-force way.
Or, does nobody want one?
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
CrayModerator
12/07/01 10:48 PM
12.78.180.54

Edit Reply Quote Quick Reply
ISTR that the Drawing Board had an average damage calculator to let you look at the average damage over range for your mech design.

Does that help? Probably not...

Mike Miller, MatE
Mike Miller, Materials Engineer

Disclaimer: Anything stated in this post is unofficial and non-canon unless directly quoted from a published book. Random internet musings of a BattleTech writer are not canon.
LordChaos
12/08/01 01:29 AM
216.161.102.136

Edit Reply Quote Quick Reply
Well, if you insist on doing it in C++, it shouldn't be too dificult.

I always was one for brut force in programing over eligence (was more likely to have stable code that way.. course that was just me).

I would set up an array of arrays for the weapons (type, damage, s/m/l + minimum rantes, any modifiers (pulse, lbx)). A second array (simpler) would be the hit % at any giveen target number. With these to, you can have it calculate for every weapon, and all that's left is an interface for entering the weapon load...

hmmm... I make it sound too simple... maybe I should brush off my C++ books and give it a try myself.
Real mechwariors pilot IS mechs.
LordChaos
12/08/01 01:37 AM
216.161.102.58

Edit Reply Quote Quick Reply
I might be able to do something like it web based.... assuming my coworker is as good as he says he is...
Real mechwariors pilot IS mechs.
NathanKell
12/08/01 06:19 PM
24.44.238.206

Edit Reply Quote Quick Reply
Well, I've used it, but I don't know how TDB calculates the numbers it gives you. I'm unhappy unless I know exactly how I got the numbers I use in a comparison ;)
Also, it has trouble with heat (IMO).
Thanks for the thought, though.
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
12/08/01 06:27 PM
24.44.238.206

Edit Reply Quote Quick Reply
Yeah, that's what I decided, though thanks for reminding me about pulse and LB-X bonuses--forgot those.
This is primarily for Level 1 anyway, though.
It took a while remembering how to grab stuff from files (as I wanted the weapons table to be editable), and while I was doing that I figured I might as well set up an array of mechs as well, so you can do comparisons.
Which meant I had to make a struct for them, so I can include name and heat sinks as well as weapons type and quantity.
Then I figured, well, after all that I should let this stuff get saved to a file so you don't have to retype it...

Anyway, so far so good. The input portion is done. You can play with it if you want (this directory, you need the exe and the file table.csv. Put them both in the same directory), though the interface is kind of clunky. Also, no spaces--use underscores (_).
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
12/08/01 09:41 PM
24.44.238.206

Edit Reply Quote Quick Reply
Update: it now loads and saves. Damage comparison (the actual point of this thing, after all ;) ) coming up next.
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
LordChaos
12/09/01 12:32 AM
216.161.102.167

Edit Reply Quote Quick Reply
You're going much faster then I would have.

Then again, I haven't touched code in about 9 years.
Real mechwariors pilot IS mechs.
NathanKell
12/09/01 09:56 PM
24.44.238.206

Edit Reply Quote Quick Reply
Well, I was a bit ahead of myself ;) It took another day's work for it to load reliably. At least it does now (I think, I've by no means been exhaustive in my testing).
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
12/09/01 09:57 PM
24.44.238.206

Edit Reply Quote Quick Reply
Well, that was the two-steps-forward stage.
Now it's the one-step-backwards stage ;)
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
12/10/01 05:37 PM
24.44.238.206

Edit Reply Quote Quick Reply
A Universal Munchstructor? Wow! That would take a *lot* of recursion.
Which would take a lot of recursion.
....

And thanks, as well--the support worked ;). It's done.
Although I'm not entirely sure it's correct, let alone bug-free, the complete version has been posted here. The whole shebang is 98k.
Readme is as follows:
In reply to:

Average Damage Calculator and Comparison Program

Files:
Comp.exe: 32-bit console executable (i.e., needs Windows but runs in a DOS box).
Comp.cpp: source.
AP *.* source for the Collegeboard AP C++ classes used in this program (see below)
table.csv: comma-separated values table of weapons, the default one loaded by the program. It is by no means current.

[The fields are self-explanatory except for the last one, which is for flags--i.e. pulse, LB-X, etc. The flags are as follows:
0=0000=no mod
1=0001=LB-X (ie -1)
2=0010=pulse (ie -2)
4=0100=MRM, Hvy Las (ie +1)
8=1000=not counted (ie TAG, AMS, artillery).
The decimal version is used in the table. Add all the values up to get the final flag. So, technically, LB-X ACs could be represented as 6 (0110).]

mechs.csv: comma-separated values table of mechs, the default one loaded from and saved to by the program.
comp.txt: text file with the output of the comparison, the default one saved to by the program.



Notes:

1. Please don't use spaces in Mech names--it confuses the program. I'll try to think up a fix for this.
2. The CSV files can easily be edited by any text editor.
3. This program uses some classes from the College Board (apstring, apmatrix, apvector.) Their AP C++ Classes website is http://www.collegeboard.org/ap/computer-science/html/classes.html
This is their disclaimer: "Inclusion of the C++ classes defined for use in the Advanced Placement Program Computer Science courses does not constitute endorsement of the other material in this program by the College Board, Educational Testing Service, or the AP Computer Science Development Committee. The versions of the C++ classes defined for use in the AP Computer Science courses included in this program were accurate as of 1998. Revisions to the classes may have been made since that time."
Now, my memory is that the versions we used in the class were broken, and were fixed. Those versions are the ones included in this archive, and work. To include apstring, include the CPP file, not the H file.

Please send comments, questions, etc. to: nkell@optonline.net


-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
12/10/01 10:41 PM
24.44.238.206

Edit Reply Quote Quick Reply
Well, you know what they say about talking to yourself, but...
Turns out that the Awesome does no damage beyond 3 hexes :D News to me.
So, those bugs were bigger than I thought! ;)
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
LordChaos
12/11/01 12:57 AM
216.161.101.183

Edit Reply Quote Quick Reply
hehehe... gee. and i though the awsome was primarily designed to fight beyond 3 hexes....

Real mechwariors pilot IS mechs.
NathanKell
12/11/01 01:21 AM
24.44.238.206

Edit Reply Quote Quick Reply
Whew! Finally (1:17am) fixed the problem. AFAIK it works now. And the Awesome spanks the rest of the mere mortals in comparison ;)
[edit] Squish! got another one...[/edit]
So, in sum, enjoy (and please report a bug if it bites you).
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson


Edited by NathanKell (12/11/01 02:10 AM)
NathanKell
12/27/02 04:42 PM
67.86.58.8

Edit Reply Quote Quick Reply
BUMP.

It still seems to work, by the way, and will prove useful in BTSW {yes, this is two plugs in one post!}
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
NathanKell
06/25/03 09:33 PM
67.86.63.119

Edit Reply Quote Quick Reply
Includes Rocket Launchers too, now.
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
CrayModerator
06/26/03 05:08 AM
68.200.106.217

Edit Reply Quote Quick Reply
You are braver than I. At this point, my average damage spreadsheet requires manual range and damage entry. It does look up the average number of missile hits when the number of tubes are given to it, but entering each weapon?
Mike Miller, Materials Engineer

Disclaimer: Anything stated in this post is unofficial and non-canon unless directly quoted from a published book. Random internet musings of a BattleTech writer are not canon.
NathanKell
06/26/03 01:29 PM
67.86.63.119

Edit Reply Quote Quick Reply
Not quite braver. I haven't tackled the alternate ammo loads of ATMs yet, I realize.
And the nice thing is, you can add custom weapons by editing the weapons file.
-NathanKell, BT Space Wars
Question with boldness even the existence of a God; because, if there be one, he must more approve of the homage of reason, than that of blind-folded fear.
Thomas Jefferson
CrayModerator
06/27/03 07:56 AM
147.160.125.185

Edit Reply Quote Quick Reply
The "core" of my spreadsheet is the following calculation:

(Damage 1) x (Damage 2) x (Hit Fraction) = Average Damage

Damage 1 = The user-entered damage value for the weapon (or per missile or per UAC/RAC shot). This can be a flat 10 for 1 PPC, 12 for 2 IS PMLs, 2 for SRMs, 12 for a SRM Streak 6, 5 for RAC/5s, etc.

Damage 2 = The average number of hits for that many of "tubes" in the "launcher." The user selects from a list: "not a launcher," or "6 tubes" for an SRM 6 or RAC firing at x6, or "6 tubes + Art/Narc" for an ATM 6 or SRM 6 with Artemis IV, etc. I've got a "missile hits chart" buried on a back sheet that has the associated average number of missile hits for anything from 2 tubes (SRM 2, UAC at x2) to LRM 20+Art/Narc, and that's referenced by the selection. If the user selects "not a launcher," Damage 2 = 1.

Hit Fraction = if the percentage chance of hitting at a given target number.

The trick was the hit fraction, which varied with range. Lots of if-thens to filter out when target numbers went over 12, or under 2, and how they varied with changing ranges (which the user also has to enter, and those have filters to prevent the short range from being longer than the medium and so forth). I was able to get in a lot of idiotproofing by just allowing user to select from a limited list of ranges (1-36, and 1-10 for minimum). But once all that was done, it was just a quick reference to a master % chart.

Because it's up to the user to enter range and damage (limited 1-40), it's possible to test custom weapons. OTOH, the spreadsheet has no clue if the user is cheating or entering in incorrect data for weapons.
Mike Miller, Materials Engineer

Disclaimer: Anything stated in this post is unofficial and non-canon unless directly quoted from a published book. Random internet musings of a BattleTech writer are not canon.
Silenced_Sonix
11/12/03 02:02 PM
168.209.97.34

Edit Reply Quote Quick Reply
No offense, but why not just use Drawing Board? It's a bit like reinventing the wheel, innit?

Anyway, it does show that you're willing to work, which is always good.
Back to Drawing board: anybody know where I can get a copy of the latest version? I'm currently running 1.1.11, and it's kinda... welll... OLD! Anyone?
Evolve or Die
tgsofgc
11/12/03 06:53 PM
67.4.202.138

Edit Reply Quote Quick Reply
I'm not posative but I think it does the following:
Takes the base gunnery adds modifiers and then multiplies the percentage chance to hit by the damage of the weapon. I know you can change alot of the things in the options menus, especially things like number of shots from autocannons.
I find that 'pinpoint' accuracy during a bombing run increases proportionally with the amount of munitions used.
-Commander Nathaniel Klepper,
Avanti's Angels, 3058
Pages: 1
Extra information
0 registered and 67 anonymous users are browsing this forum.

Moderator:  Nic Jansma, Cray, Frabby, BobTheZombie 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Topic views: 8549


Contact Admins Sarna.net