Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
fetch data to cache, use everything together and format automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryQuan committed Jan 1, 2022
1 parent fc14ebd commit 92898bf
Show file tree
Hide file tree
Showing 25 changed files with 8,806 additions and 15,595 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# json and all temp files
**/.ipynb_checkpoints
*.json
**/__pycache__/
Expand All @@ -8,4 +9,10 @@
**/cache/

# virtual environment
.env/
.env/

# include node packages
!package*.json
!.prettierrc.json
# ignore node_modules
**/node_modules/
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore folders
cache/
.vscode/
.env/
icons/
node_modules/
tools/

# Ignore all python files
*.py

# never format plugin because it needs to be small
data/plugin.json
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# WoWs Game Data (0.9.6.0)
# WoWs Game Data (0.10.10.0)

Extract some game data from World of Warships. There are also some other data that are collected by me. Most of them are formatted so it is possible to see what has changed. I may add more if WoWs Info needs it.

- GameParams is coming from WoWSFT-Data
- ship_battle_raw is parsed from Wows-Numbers

## Setup

You need to install python3, jyputer notebook and matplotlib (optional)

## Modernizations

It includes all modernization (upgrades, legendary upgrades and special upgrades).

## Ship Additional

Some additional information for all ships that don't exist in the official API.

- Shell sigma
Expand All @@ -19,32 +26,45 @@ Some additional information for all ships that don't exist in the official API.
- Total battles (from https://wows-numbers.com/ships/, dataProvider.ships)

### AP Penetration

- [reddit post](https://www.reddit.com/r/WorldOfWarships/comments/560yg2/wows_ballistic_model_penetration/)
- [matlab version](https://pastebin.com/1NEwkf7R)
- [kotlin version](https://github.com/EdibleBug/WoWSFT-Kotlin/blob/5d4ce2d4ffb722c010b265ce3c39417eddd009c7/WoWSFT-Data/src/main/kotlin/WoWSFT/utils/PenetrationUtils.kt) by wowsft
- [python version](https://github.com/HenryQuan/WoWs-Game-Data/blob/master/ap_pen.py) by me
- [dart version]() by me (coming soon, it will be used in WoWs Info app)

## Ship consumables
All available ship consumables in the game.

All available ship consumables in the game.

## Removed ships

A list of ships that are changed due to rework or removed in the game. The data come with tier and name.

# Icons
Now, it only has consumable icons and they will be added to WoWs Info later.

Now, it only has consumable icons and they will be added to WoWs Info later.

# Extra

Extra data that might be interesting to see.

## Long range torpedoes (>= 12km)

A list of torpedoes which are more than 12km in range. There are some interesting ones that are not available in game.

## Fast reloading guns (< 4sec)

## Slow reloading guns (> 30sec)

## Big guns (>= 410mm)

## Small guns (< 120mm)

## Ships

All ships in the game including deleted ships and special event ships.

## Submarines
A list of all submarines in the game. There are currently not visible on the API.

A list of all submarines in the game. There are currently not visible on the API.
50 changes: 29 additions & 21 deletions ap_pen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,32 @@
from math import *
import matplotlib.pyplot as plt

# SHELL CONSTANTS, they should be provided

def get_ap_penetration(ap, output=False):
penetration_value = 0.5561613 # PENETRATION
G = 9.81 # GRAVITY
sea_level_temperature = 288 # TEMPERATURE AT SEA LEVEL
temperature_lapse_rate = 0.0065 # TEMPERATURE LAPSE RATE
sea_level_pressure = 101325 # PRESSURE AT SEA LEVEL
univ_gas_constant = 8.31447 # UNIV GAS CONSTANT
mass_air = 0.0289644 # MOLAR MASS OF AIR
penetration_value = 0.5561613 # PENETRATION
G = 9.81 # GRAVITY
sea_level_temperature = 288 # TEMPERATURE AT SEA LEVEL
temperature_lapse_rate = 0.0065 # TEMPERATURE LAPSE RATE
sea_level_pressure = 101325 # PRESSURE AT SEA LEVEL
univ_gas_constant = 8.31447 # UNIV GAS CONSTANT
mass_air = 0.0289644 # MOLAR MASS OF AIR

shell_weight = ap['weight']
shell_diameter = ap['diameter']
shell_drag = ap['drag']
shell_velocity = ap['velocity']
shell_krupp = ap['krupp']

cw_quadratic = 1 # QUADRATIC DRAG COEFFICIENT
cw_linear = 100 + 1000 / 3 * shell_diameter # LINEAR DRAG COEFFICIENT
cw_quadratic = 1 # QUADRATIC DRAG COEFFICIENT
cw_linear = 100 + 1000 / 3 * shell_diameter # LINEAR DRAG COEFFICIENT

penetration_value = penetration_value * shell_krupp / 2400 # KRUPP INCLUSION
drag_constant = 0.5 * shell_drag * (shell_diameter / 2) ** 2 * pi / shell_weight # CONSTANTS TERMS OF DRAG
penetration_value = penetration_value * shell_krupp / 2400 # KRUPP INCLUSION
drag_constant = 0.5 * shell_drag * \
(shell_diameter / 2) ** 2 * pi / \
shell_weight # CONSTANTS TERMS OF DRAG

alpha = []
# ELEV. ANGLES 0...15,
# ELEV. ANGLES 0...15,
# 150 is used here because step cannot be 0.1, the point here is to have lots of angles
# 150 should be replace because it is different for every ship
for i in range(0, 150, 1):
Expand All @@ -42,7 +44,7 @@ def get_ap_penetration(ap, output=False):
armour = []
distance = []
time = []
dt = 0.1 # TIME STEP
dt = 0.1 # TIME STEP

# for each alpha angle do:
for i in range(1, len(alpha)):
Expand All @@ -51,27 +53,30 @@ def get_ap_penetration(ap, output=False):
x = 0
y = 0
time_taken = 0

# follow flight path until shell hits ground again
while y >= 0:

x = x + dt * v_x
y = y + dt * v_y

temperature = sea_level_temperature - temperature_lapse_rate * y
pressure = sea_level_pressure * (1 - temperature_lapse_rate * y / sea_level_temperature) ** (G * mass_air / (univ_gas_constant * temperature_lapse_rate))
pressure = sea_level_pressure * (1 - temperature_lapse_rate * y / sea_level_temperature) ** (
G * mass_air / (univ_gas_constant * temperature_lapse_rate))
rho = pressure * mass_air / (univ_gas_constant * temperature)

v_x = v_x - dt * drag_constant * rho * (cw_quadratic * v_x ** 2 + cw_linear * v_x)
v_x = v_x - dt * drag_constant * rho * \
(cw_quadratic * v_x ** 2 + cw_linear * v_x)
# copysign when x = 1, it is the same as sign
v_y = v_y - dt * G - dt * drag_constant * rho * (cw_quadratic * v_y ** 2 + cw_linear * abs(v_y)) * copysign(1, v_y)
v_y = v_y - dt * G - dt * drag_constant * rho * \
(cw_quadratic * v_y ** 2 + cw_linear * abs(v_y)) * copysign(1, v_y)

time_taken = time_taken + dt


v_total = (v_y ** 2 + v_x ** 2) ** 0.5
# PENETRATION FORMULA
ap_pen = penetration_value * v_total ** 1.1 * shell_weight ** 0.55 / (shell_diameter * 1000) ** 0.65
ap_pen = penetration_value * v_total ** 1.1 * \
shell_weight ** 0.55 / (shell_diameter * 1000) ** 0.65
# IMPACT ANGLE ON BELT ARMOR
impact_angle = atan(abs(v_y) / abs(v_x))

Expand Down Expand Up @@ -99,5 +104,8 @@ def get_ap_penetration(ap, output=False):
ax2.plot(distance, time)
plt.show()


# testing only
# get_ap_penetration({'weight': 55, 'drag': 0.321, 'velocity': 950, 'diameter': 0.152, 'krupp': 2216})
if __name__ == '__main__':
get_ap_penetration({'weight': 55, 'drag': 0.321,
'velocity': 950, 'diameter': 0.152, 'krupp': 2216})
Loading

0 comments on commit 92898bf

Please sign in to comment.