Login

russian armor

The CoH2 Pen Calculator

MMX
24 Nov 2021, 12:20 PM
#1
avatar of MMX

Posts: 999 | Subs: 1

Hey everyone...

MMX here once again to present you another handy spreadsheet for your daily dose of CoH2 unit comparisons - this time on the menu: tank vs tank combat!

So without any further ado, here is what this thing can do:

  • Calculate the chance to hit (including scatter) and penetrate a chosen target at a given distance, allowing an estimate of the number of shots (S2K) and time (T2K) required to kill the target.
  • Calculate the probability that the target is killed after n shots fired or n seconds elapsed and display the results in fancy graphs for better visualization.
  • Simulate a fight between two tanks at a given distance and and selected modifiers to calculate the average chance to win and the most probable HP margin.


Where to get the Pen Calculator ?

First release version (2.0) can be found here!

An update with new features, much faster simulation speed, improved deflection hit calculation and a couple of bugfixes is now available here!


How to use the Pen Calculator?

Opening the spreadsheet, you should be greeted with the general interface of the calculator tab as in the picture below:



To calculate and visualize the hit and pen chance, as well as the average S2K, T2K and probability distributions, simply select the distance (col B), the attacker (col D:H) and target unit (col J:N) as desired and choose additional target modifiers, such as moving or FoW penalties (col O) as well as the facing (front or rear; col P) if necessary.
While the results are calculated and updated instantly, there is also the option to switch to a numerical simulation in situations where the standard calculation algorithm is inaccurate. This is the case for units with deflection damage (for example; the KV-2 as in the image below), for which I haven't figured out a way to calculate the results via standard binomials and, thus, deflected hits aren't properly modeled.



To generate the necessary data just switch the data source (col R) from "Calculator" to "Simulator", press the "Simulate" button and twiddle your thumbs for 1 or 2 minutes (or less, if you lower the # of iterations in the "Simulator" tab) until the sim finishes.

In order to customize the probability plots there are additional drop-down menus on the very left that allow switching between time elapsed and shots fired on the x-axis and continuous or stepwise display of the probability curves.

Last but not least, the "Head-to-head" tab, an hommage to (or rather a shameless rip-off of) Hannibal's DeCoHde 2.0 , contains a small simulator that can be used to calculate the win probability of a specific match up between two tanks by running a short numerical sim.



As in the calculator tab, simply choose the two contestants and desired conditions before pressing "Fight!!", and the sim should spit out the results in less than 2 minutes.


What can the Pen Calculator not (yet) do?

While most parameters in tank vs. tank engagements are relatively easy to compute, scatter has proven to be a bit tricky to incorporate into a rigid model, not least because the actual sizes and shapes of the tank's hit boxes aren't known very well. The fact these had to be estimated along with a couple of other simplifications means that the displayed scatter hit probabilities (and the results derived with them) should always be taken with a grain of salt. Nonetheless, in-game testing seems to confirm that the results are convincingly close and should serve as a good benchmark when comparing the combat effectiveness of certain tanks with each other.

As this is kind of a work in progress, further improvements along the way as well as a couple of other features currently still on my 'wishlist' (such as engagements at different angles other than 0 and 180°) are definitely planned if time permits.


Anyway, before signing off another big shout out to Hannibal for bringing many of the outdated info in the data page up to date.
And as always, any feedback or error report is very much appreciated!

--MMX--


EDIT 11/25/2021: Just noticed that some last-minute formatting totally screwed up the VBA cell references in the "Head-to-Head" tab, causing the simulator not to work at all -.-
Fixed version now live.


EDIT 12/09/2021: An update to the spreadsheet is now online.

- Small overhaul to the UI of the Calculator and Head-to-Head tabs with additional graphs for the average S2K and T2K values
- Fixed an issue with the calculation algorithm that lead to the overestimation of AT performance for units with deflection damage (i.e. ISU-152, KV-2, Brummbär and 105mm Dozer Sherman)
- Fixed the simulated probability curves not being displayed correctly when set to non-continuous plotting mode
- Fixed an issue where the Facing selector in the Head-to-Head tab where applied to the wrong tank.
- Updated some errors in the data tab and added a preset for the Easy 8 in Focused Gunnery mode


EDIT 12/15/2021: Another small update can be found here that vastly increases the speed of the numerical simulation (~ 10x faster!) used throughout the spreadsheet. Alongside, a number of changes introduced with the last patch have now finally made into the data tab of the spreadsheet as well (hope I got all of them this time -.-)
24 Nov 2021, 14:06 PM
#2
avatar of Hannibal
Senior Moderator Badge

Posts: 3114 | Subs: 2

This is very cool stuff! Will be more helpful since people will rather user a table calculation program rather than Python where I cobble my stuff together. I'll have to have a look soon when I find the time!


Since I assume you referred to this calculator in the "Ostheer accuracy" thread, I have a question:
How did you get the 24% scatter hit chance in the PaK vs T70 match up? Don't you need some value for the vehicle size in that one, or at least the width of the T70? Since we don't have that, what did you take as a substitute for estimation?


EDIT:
The only thing I noticed at the moment is that some ROF times are a bit off? Units like the Panther for example fire a bit faster than they are in game.
24 Nov 2021, 14:23 PM
#3
avatar of Vipper

Posts: 13496 | Subs: 1

24 Nov 2021, 15:24 PM
#4
avatar of Klement Pikhtura

Posts: 772

Damn, imagine all this in JS available online sort of like sym.gg was for Battlefield games.
MMX
25 Nov 2021, 04:45 AM
#5
avatar of MMX

Posts: 999 | Subs: 1

This is very cool stuff! Will be more helpful since people will rather user a table calculation program rather than Python where I cobble my stuff together. I'll have to have a look soon when I find the time!


Since I assume you referred to this calculator in the "Ostheer accuracy" thread, I have a question:
How did you get the 24% scatter hit chance in the PaK vs T70 match up? Don't you need some value for the vehicle size in that one, or at least the width of the T70? Since we don't have that, what did you take as a substitute for estimation?


EDIT:
The only thing I noticed at the moment is that some ROF times are a bit off? Units like the Panther for example fire a bit faster than they are in game.



Thanks a lot!

You're right about the vehicle size being a bit of a" guesstimate" atm, since there's no way to extract these from the game files (at least that I'm aware of). Most of the values are therefore just rough measurements of the size of the model obtained using the grid in cheatmod. I did some validation for a couple of tanks which seem to coincide quite nicely with the visual dimensions of the respective units, but that of course isn't guaranteed to be the case for all tanks.

I'd probably try to 'measure' some more in the future, but my current approach is rather time-consuming. For those interested, this is what I used for calibration:



As to the ROF being a bit off for some units, I used an old formula to calculate the average time between shots that might be somewhat inaccurate, especially in light of what you dug up recently in your ROF thread. I don't think the deviation is too great (maybe a frame more or less here and there), but I'll probably try to update this in a future release...

Or are you specifically talking about the delays in the 'Head-to-head' tab? These are randomized between the theoretical min and max values on purpose to give the sim a more realistic 'feel'.
MMX
25 Nov 2021, 04:57 AM
#6
avatar of MMX

Posts: 999 | Subs: 1

Damn, imagine all this in JS available online sort of like sym.gg was for Battlefield games.


Yeah, I'd love to have this available as an online version as well, since I know not everyone, especially the younger folks, has excel to play around with spreadsheets all day. Unfortunately, I suck at programming and google sheets is quite limited in what it can do... but hopefully some day someone else will stand up to the challenge and code a html version of this. After all we still have unsung heroes like pageP in this community just waiting to step into the limelight.
MMX
25 Nov 2021, 15:42 PM
#7
avatar of MMX

Posts: 999 | Subs: 1

Just noticed that some last-minute formatting totally screwed up the VBA cell references in the "Head-to-Head" tab, causing the simulator not to work at all -.-
Fixed version now live here or via the updated link in the OP.
25 Nov 2021, 17:44 PM
#8
avatar of Hannibal
Senior Moderator Badge

Posts: 3114 | Subs: 2

jump backJump back to quoted post25 Nov 2021, 04:45 AMMMX


Took me quite a few reads to actually get what you're doing to test the length of the vehicle. I had to laugh a bit to be honest, it looks like the poor man's equivalent to analyse the velocity by analyzing frames in a video. At the same time it is super creative.

Anyway, the way I thought about this initially was closer to your second suggestion. Basically count how many shots have missed and how many hit with a modified unit (0 accuracy, 0 horizontal scatter, no impact etc). Based on the scatter angle and the ratio of hit shots, you should be able to estimate the length. Are you really sure you need so many repetitions? By gut feeling I would have assumed that probably 100 would already be at least okay, although I have not tried to estimate this with a calculation.

However, I had a second idea:
We could take a bunch of standardized vehicles (0 accuracy etc as above...) that just differ in their scatter angle. Each will then shoot at a target at fixed distance. If the scatter angle is too small, all shots will hit. If it is too large, there will be misses. At range 40, each 1° increment in the scatter stat would correspond to 0,35m in vehicle width. So depending on how the angle increments are set up, it would probably be possible to nail the width down by 0,2-0,3 meters.

On the other hand, I think your second method is probably more straight forward. I'd just take less shots, should be good enough. Especially if you can cross check with similarly sized units. If the test gives you similar results for the P4 and T34, I wouldn't worry too much about it.

jump backJump back to quoted post25 Nov 2021, 04:45 AMMMX
As to the ROF being a bit off for some units, I used an old formula to calculate the average time between shots that might be somewhat inaccurate, especially in light of what you dug up recently in your ROF thread. I don't think the deviation is too great (maybe a frame more or less here and there), but I'll probably try to update this in a future release...

Or are you specifically talking about the delays in the 'Head-to-head' tab? These are randomized between the theoretical min and max values on purpose to give the sim a more realistic 'feel'.

Yes, I was mostly asking about the head-to-head tab. If you'd have taken the average reload time, it could make the difference between consistently shooting 0,1 seconds earlier than the opponent which would lead to a clear victory. The randomization doesn't solve this, but at least will give some more realistic picture of the real variance.
25 Nov 2021, 18:11 PM
#9
avatar of Vipper

Posts: 13496 | Subs: 1

I am under the impression that one can see the actual hitbox by using the map editor...
MMX
26 Nov 2021, 05:32 AM
#10
avatar of MMX

Posts: 999 | Subs: 1


Took me quite a few reads to actually get what you're doing to test the length of the vehicle. I had to laugh a bit to be honest, it looks like the poor man's equivalent to analyse the velocity by analyzing frames in a video. At the same time it is super creative.

Anyway, the way I thought about this initially was closer to your second suggestion. Basically count how many shots have missed and how many hit with a modified unit (0 accuracy, 0 horizontal scatter, no impact etc). Based on the scatter angle and the ratio of hit shots, you should be able to estimate the length. Are you really sure you need so many repetitions? By gut feeling I would have assumed that probably 100 would already be at least okay, although I have not tried to estimate this with a calculation.

However, I had a second idea:
We could take a bunch of standardized vehicles (0 accuracy etc as above...) that just differ in their scatter angle. Each will then shoot at a target at fixed distance. If the scatter angle is too small, all shots will hit. If it is too large, there will be misses. At range 40, each 1° increment in the scatter stat would correspond to 0,35m in vehicle width. So depending on how the angle increments are set up, it would probably be possible to nail the width down by 0,2-0,3 meters.

On the other hand, I think your second method is probably more straight forward. I'd just take less shots, should be good enough. Especially if you can cross check with similarly sized units. If the test gives you similar results for the P4 and T34, I wouldn't worry too much about it.


Yeah, now that you say it the length measurement method surely is kind of the poor man's solution to frame-counting... albeit it did at least prove that the size of the in-game model seems to be roughly equivalent to that of the hitbox.

I've been thinking about your suggestion to reduce the number of rounds used for probing the dimensions of the hitbox, and you're definitely right that 5000 is way over the top. In theory, 100 sampling shots should give a standard deviation of +/- 5% in the worst case (50/50 chance of hitting) - not too bad for a rough estimate for sure. Upping the number to 500 would cut the standard deviation about in half and shouldn't be too taxing time-wise either, so maybe that's a good compromise between accuracy and effort. I'll try to set up some measurements later today and see how reproducible the results are and how well they line up with the visual estimates.

However, if Vipper is right and the hitboxes can be measured via the map editor, this would of course be even better!


Yes, I was mostly asking about the head-to-head tab. If you'd have taken the average reload time, it could make the difference between consistently shooting 0,1 seconds earlier than the opponent which would lead to a clear victory. The randomization doesn't solve this, but at least will give some more realistic picture of the real variance.


Fair point. Will definitely have a look into that one.
26 Nov 2021, 17:12 PM
#11
avatar of Hannibal
Senior Moderator Badge

Posts: 3114 | Subs: 2

jump backJump back to quoted post26 Nov 2021, 05:32 AMMMX


Yeah, now that you say it the length measurement method surely is kind of the poor man's solution to frame-counting... albeit it did at least prove that the size of the in-game model seems to be roughly equivalent to that of the hitbox.

I've been thinking about your suggestion to reduce the number of rounds used for probing the dimensions of the hitbox, and you're definitely right that 5000 is way over the top. In theory, 100 sampling shots should give a standard deviation of +/- 5% in the worst case (50/50 chance of hitting) - not too bad for a rough estimate for sure. Upping the number to 500 would cut the standard deviation about in half and shouldn't be too taxing time-wise either, so maybe that's a good compromise between accuracy and effort. I'll try to set up some measurements later today and see how reproducible the results are and how well they line up with the visual estimates.

However, if Vipper is right and the hitboxes can be measured via the map editor, this would of course be even better!

Map editor would be great, although these would probably also only be estimates. What good is it seeing the hit box when you can't really reference it that well? Although maybe a speed mod or something would help in that regard.

Anyway, I played around with the numbers. Running 500 shots should give you a 95% chance of having less than 15% error for smaller tanks (assuming those are only ~2m wide which would be in line with your 24% hit chance of a PaK40 on a T70 that you estimated), ~7% for mediums (assuming ~5m width) and about 4% for larger vehicles (assumed ~7 meters).
1000 shots improve these numbers to 11%, 5%, 3% for small/medium/large vehicles.
5000 shots improve to 5%, 2%, 1%.

But again, this means that in 95% of the measurements, you will have LESS error than this and be closer to the actual value.
26 Nov 2021, 22:07 PM
#12
avatar of DAZ187

Posts: 466

great work
MMX
27 Nov 2021, 07:33 AM
#13
avatar of MMX

Posts: 999 | Subs: 1


[...]


So I've been toying around with measuring the hitboxes a bit more and it seems the results are pretty close to the visual estimation. Using a scatter angle of 2.5 at a distance of 200 m and 500 shots per run this is what I got for the T-70, T-34 and Sherman:


The width is in pretty good agreement with what I measured before (2.5 m for the T-70, 3.75 m for the T-34 and 3 m for the M4C) and the standard deviation between the runs is rather small (< 3%). The length, however, seems a bit off for the T-70 and T-34, which I estimated at 5 and 6.5 m previously. Still not too bad.

All in all I'd say the visual measurements should be reasonably close to the ingame hitboxes for most tanks, but getting some more precise data would surely come in handy. Also, there are some tanks, such as the SU-76, that seem to rotate noticably off-center to what the visual model would suggest. I'll probably have to check if that also has some effect on the size and orientation of the hitbox.


MMX
9 Dec 2021, 14:40 PM
#14
avatar of MMX

Posts: 999 | Subs: 1

Another small update that fixes a couple of issues, adds some new features and improves the accuracy of the simulation for tanks with deflection damage is now online.


Improved interface and features

The interface of the calculator tab was updated to include a bar graph visualizing the average S2K and T2K values +/- SD for quick and easy comparison of the different match ups.


The head-to-head tab also got a new feature that allows to filter the results by setting a maximum engagement time (Time cut-off; cell A34) for the fight. If no winner is determined within the set limit, the fight is considered a draw and the results updated accordingly. In addition, the minimum, maximum and average time to win for each tank is displayed below the win chance graph.




Deflection damage

As it turns out, deflection damage (outside of handheld AT) can bring a tank to 0 HP but even subsequent deflected shots will not kill the target. This means that the previous calculation method overestimated the AT performance of tanks such as the KV-2 a bit. The improved simulator now takes this into account and should be more accurate than in the previous release.



9 Dec 2021, 14:43 PM
#15
avatar of BasedSecretary

Posts: 1197

Just tried it.

Really good mate. Great job.
MMX
9 Dec 2021, 15:00 PM
#16
avatar of MMX

Posts: 999 | Subs: 1

Just tried it.

Really good mate. Great job.


Thanks a lot man, glad to hear you give it a try!
MMX
15 Dec 2021, 07:10 AM
#17
avatar of MMX

Posts: 999 | Subs: 1

A couple of days ago I stumbled upon a neat little VBA feature that greatly improved the performance of the numerical simulation used throughout the spreadsheet. The more programming-savvy folks will now probably roll their eyes, but that day I found out that not only is it possible to manually define when to recalculate the whole workbook (which I already used to speed up the code quite considerably before), but also to limit the recalculation to a specific range in the spreadsheet.

Well, turns out updating just a couple of cells with volatile functions is considerably faster than recalculating the entire workbook several thousand times over - who would've thought?? :facepalm:

Anyway, suffice to say that the code is now much faster and what took a good 2.5 minutes before on my 5-yo potatoe now runs in less than 10 seconds.

The updated spreadsheet that now also contains (hopefully) all of the changes brought along with the most-recent patch can be found here or via the updated link in the OP.
1 user is browsing this thread: 1 guest

Livestreams

unknown 8
Germany 1

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

612 users are online: 1 member and 611 guests
donofsandiego
0 post in the last 24h
6 posts in the last week
38 posts in the last month
Registered members: 49060
Welcome our newest member, starkindustries
Most online: 2043 users on 29 Oct 2023, 01:04 AM