[A17][A16][Utility] Ranged Accuracy Calculator (Updated 27/5/2017)

Started by XeoNovaDan, April 15, 2017, 12:32:50 PM

Previous topic - Next topic

XeoNovaDan

Overview
This is a little utility I've written in Python which actually went on to become somewhat of a project thanks to b0rsuk's feedback, and I'm actually very highly appreciative of that. This accuracy calculator has a variety of features which allows for the experience that you want, whether you're just the average player, an experienced player, or even a modder: you can pick from 3 modes which determine how the functions will run, and you can in turn pick from 4 functions. This calculator also has the option to incorporate a very similar accuracy report not unlike the one you see in the actual game.

For best aesthetic results, use in fullscreen mode. Resolutions listed below are in order to keep everything neatly presented...
Bare minimum (no rich reports): 640x480
Minimum: 800x600
Recommended: 1024x768 or higher

Features of RimWorld Ranged Accuracy Calculator v1.3.17_r1
    - The ability to calculate accuracy with the following factors
        - Pawn (shooter)
        - Weapon
        - Weather
        - Cover
        - Target size
    - 3 modes to select from
        - Normal
        - Advanced
        - Custom
    - 4 functions to select from
        - Pawn
        - Weapon
        - Pawnweapon (Pawn and Weapon)
        - Full (pawn, weapon, weather, cover, and target size)
    - The ability to export results to a CSV file (best done in Pawn and Weapon mode)
        - You can name this CSV file almost as you wish. Invalid characters (i.e. punctuation) will be handled
        - This CSV file can be imported by spreadsheet-handling programs or online graphing programs
            - Examples include Microsoft Excel, Google Sheets, and Plotly
        - The imported information can furthermore be converted to graphs to better visualise info
    - Feedback of statistics which play a role in the accuracy calculation
        - Written in a way that the program will only show certain statistics if you used that function
        - Even possible to display richer information that is similar to the mouse-over in-game
            - Automatic bottleneck identifying comes with this
    - Run multiple trials in one sitting, with appropriate titles so you can keep track
        - The option to switch mode and function at the beginning of each successive trial
    - You can decide how many tiles you want the calculator to output
        - Maximum of 50 tiles
    - Accurate replication of the game's shooting mechanics
    - Native support for Shooting Skill Rebalanced and Vanilla-Friendly Weapon Expansion

Sample Output (v1.3.17_r1)


I was able to get this sample output to look a little better by editing a printscreen of the calculator running, by dividing the x-axis width by 1.25. The power of editing!

Mode: Normal
Function: Full
Parameters: Level 4 careful shooter (100% consciousness, 120% sight, 90% manipulation); normal quality Great Bow with 21% HP; clear weather; shooting at a juvenile elk; behind an ancient concrete barrier at a 58 degree angle from the shooter. Displaying rich accuracy feedback; 32/50 tiles of the output; exporting to a CSV file.

Links
GitHub Release - click [A17] RimWorld Accuracy Calculator.zip for the A17 version executable
Source Code

Update log:
v1.3.17_r1 (27/5/2017)
- Animal Bodysizes now line up with A17's values
- Now able to enter target's life stage with normal full mode
- Quality of life improvements by effectively no longer making worded inputs (as many as I could find) case-sensitive
- Some guides added in certain fields
- Some other minor changes

v1.2.17_r2 (27/5/2017)
- Corrected values for 0.17.1546 (this was initially a chore to do)
- Added all new items introduced with A17
- Support for VFWE v1.2.1
- Fixed a bug with weapon selection

v1.2.17_r1 (6/5/2017)
- Tweaked formulae for A17.1529
- Added values for Chain Shotgun
- Listing weapons now shows their accuracy values

v1.2.16_r1 (29/4/2017)
- Support for Vanilla-Friendly Weapon Expansion v1.1
- Able to control how many results the calculator outputs
- Header for 10+ trials now works properly

v1.1.16_r5 (18/4/2017)
- Support for Shooting Skill Rebalanced v1.3 + Accuracy LITE
- Curve-tick limit re-introduced and dynamic

v1.1.16_r4 (15/4/2017)
- Bugfixes
    - No longer spams modes when prompting for function modes in custom mode
    - Advanced mode cover effectiveness now works properly
- Code for pawn post-process curve is now much more flexible and compact
- Minor text changes in advanced mode (consistency)

v1.1.16_r3 (29/3/2017)
- You can now enter a name for your CSV file if exporting to CSV
    - Punctuation will be converted to dashes
- Optimised the function selection
    - Now chooses based on function first, then checks mode in the function scripts
- Bottleneck margin decreased on rich feedback (3% -> 2%)
- Target now comes before cover in full and custom modes.

v1.1.16_r2 (24/3/2017)
- Fixed advanced mode field exceptions if blanks are entered
- Minor rephrasing done for advanced weapon accuracy, rich feedback, and CSV
- Advanced weapon accuracy can now factor quality and health percentage

v1.1.16_r1 (23/3/2017)
- Option to write data to a .csv file
    - Allows graphing if imported to a spreadsheet handler (e.g. Excel, Google Sheets)
    - Contains all finalised values except bottleneck, as it'll be visualised by the graph itself
    - File name is based on date and time (RimworldAccCalc_mm-dd-yy_hh-mm-ss.csv)
- Fixes to retrieving weapon list and certain angles for cover
-- HOTFIX: Percentages now converted to whole numbers when building CSV. Fixed graphing issues within my testing.

v1.0.16_r4 (22/3/2017)
- Bottleneck and additional range display with tooltip per tile
- Most post-process curve values now tied to a constant and a multiplier
- Tree cover effectiveness corrected (0.42 -> 0.43)

v1.0.16_r3 (16/3/2017)
- Fixed sight multiplier in pawn_acc_subfuncs
    - This was the reason behind inconsistencies
    - 0.9 -> 0.95
- Removed some redundant variables
- Minor performance and optimisation improvements
- Annotations added to source code

v1.0.16_r2 (11/3/2017)
- Displayed ranges under 10 tiles now line up with the rest
- Report isn't spaced as far from the main accuracy output (3 tabs -> 1 tab)
- Now shows what mode and function you currently have when prompted to change

v1.0.16_r1 (11/3/2017)
- Numerous QoL improvements
    - Ability to restart after calculation
    - Show how many trials you've run in one sitting
    - Shows some numbers before (and optionally alongside) accuracy calculation
- 'custom' mode for a bespoke experience
    - Mix and match 'normal' and 'custom' (formerly 'advanced') variables as you desire
- 'pawnweapon' function, which only prompts pawn and weapon accuracy
- New parameters for cover and target
    - Like weather, these are optional and only available with the 'full' function
    - Naturally also available in 'custom' mode
- Exception handling fully implemented
- Further attempted optimisation
    - Re-written the display function
    - Some things moved to dictionaries

v0.2 (5/3/2017)
- Modes (normal and advanced)
    - Normal for the average user (you select values from predefined lists)
    - Advanced for experienced users and modders (you input your own values)
- Most exception handling in place
- 'both' function renamed to 'full'

v0.1 (3/3/2017)
- Released

XeoNovaDan