Skip to content

Commit c66d4b6

Browse files
committed
Completed Readme
1 parent c2934b4 commit c66d4b6

File tree

8 files changed

+30
-27
lines changed

8 files changed

+30
-27
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ If you too are an occasional Smash player and a stats nerd, this is for you!
2828
First, download the script. You CAN download the whole repository, but I'd suggest to download the latest release (whcih you can find [here](https://github.com/Fran314/SmashDataCollector/releases)), as it has only the stuff that you need to run the script and not the bunch of stuff that I needed and need to make the character faces database.
2929
### What to do when you're Smashing
3030
In order to save a match for collecting the data later, you'll have to take two screenshots (using the screenshot button on the Switch, and not any other screenshot function that your monitor/television might have) for every match you play. In particular, you'll have to take a screenshot of the result screen where the "Out at" time is displayed (and we'll call it first screenshot), and a screenshot of the result screen where the kills, falls, damage taken and damage given are displayed. An example of what the first and second screenshot should look like is this:
31-
![first screenshot](data/2020121110511900_c.jpg)
32-
![second screenshot](data/2020121110513400_c.jpg)
31+
![first screenshot](readme_images/2021010119113300_c.jpg)
32+
![second screenshot](readme_images/2021010119115300_c.jpg)
3333
Taking the first screenshot is just pressing the screenshot button, it's as easy as it gets.
34-
For the second screenshot you have to be a bit more precise, because the menu is a scrolling menu and not all the necessary stats are displayed before scrolling the menu. When you take the second screenshot you have to make sure that the scroll menu is not too high (which means the right side of the "Falls" row should be fully visible) and not too low (the right side of the "Taken damage" row should be fully visible). It is a bit annoying to have to check out for this, but the range of positions for the scroll menu for it to be a valid screenshot is very wide, so it's not as annoying as it sounds.
34+
For the second screenshot you have to be a bit more precise, because the menu is a scrolling menu and not all the necessary stats are displayed before scrolling the menu. When you take the second screenshot you have to make sure that the scroll menu is not too high (which means the left side of the "Falls" row should be fully visible) and not too low (the right side of the "Taken damage" row should be fully visible). It is a bit annoying to have to check out for this, but the range of positions for the scroll menu for it to be a valid screenshot is very wide, so it's not as annoying as it sounds.
3535
Here's examples of valid and invalid positions of the scroll menu:
36+
![top limit](readme_images/top_limit.png)
37+
![bottom limit](readme_images/bottm_limit.png)
3638
After these two screenshot you can go for the next match. That's all it takes, and once you get used to it, it really just takes you away a couple of seconds per match!
3739

3840
### How to transfer the screenshots

SmashDataCollector.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
sys.exit(0)
1717

1818
#--- FIND MATCHES ---#
19-
dirs = fun.mergeSort(os.listdir(custom.data_path))
19+
dirs = fun.mergeSort(os.listdir(custom.DATA_PATH))
2020
if(len(dirs) % 2 != 0):
2121
print("Odd number of images present in data. Ignoring the last image.")
2222
dirs = dirs[:-1]
@@ -28,8 +28,8 @@
2828
problematic_matches = []
2929
for match_index in range(tot_matches):
3030
print(f'Match #{match_index+1} out of {tot_matches}')
31-
first_data = cv2.imread(os.path.join(custom.data_path, dirs[2*match_index]))
32-
second_data = cv2.imread(os.path.join(custom.data_path, dirs[2*match_index+1]))
31+
first_data = cv2.imread(os.path.join(custom.DATA_PATH, dirs[2*match_index]))
32+
second_data = cv2.imread(os.path.join(custom.DATA_PATH, dirs[2*match_index+1]))
3333

3434
try:
3535
#--- FIRST IMAGE ---#
@@ -216,7 +216,7 @@
216216
print(f'elapsed time: {(time.time() - t):.3f} s')
217217

218218
#--- WRITE TEMPORARY OUTPUT ---#
219-
output_file = open(custom.output_path, 'w')
219+
output_file = open(custom.OUTPUT_PATH, 'w')
220220
for match in output_strings[:-1]:
221221
output_file.write(match)
222222
output_file.write("\n")
@@ -231,8 +231,8 @@
231231
print(f'Problematic match #{match_counter+1} of {len(problematic_matches)} (match #{problematic_match[0]+1})')
232232
print(f'Problem: {problematic_match[1]}')
233233

234-
first_data = cv2.imread(os.path.join(custom.data_path, dirs[2*problematic_match[0]]))
235-
second_data = cv2.imread(os.path.join(custom.data_path, dirs[2*problematic_match[0]+1]))
234+
first_data = cv2.imread(os.path.join(custom.DATA_PATH, dirs[2*problematic_match[0]]))
235+
second_data = cv2.imread(os.path.join(custom.DATA_PATH, dirs[2*problematic_match[0]+1]))
236236
valid_data = False
237237
while(valid_data == False):
238238
valid_data = True
@@ -340,7 +340,7 @@
340340
pass
341341

342342
#--- WRITE OUTPUT ---#
343-
output_file = open(custom.output_path, 'w')
343+
output_file = open(custom.OUTPUT_PATH, 'w')
344344
for match in output_strings[:-1]:
345345
output_file.write(match)
346346
output_file.write("\n")

customizable.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
data_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\data'
2-
res_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\res'
3-
output_path = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\output.tsv'
1+
DATA_PATH = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\data'
2+
RES_PATH = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\res'
3+
OUTPUT_PATH = r'C:\Users\franc\Documents\VSCode\SmashDataCollector\output.tsv'
44

55
# Set the language variable to 0, 1 or 2 according to the following:
66
# 0 for Japanese or Korean
77
# 1 for English, Italian, Dutch or Russian
88
# 2 for French, Spanish or German
99
# 3 for Chinese (traditional or simplified)
1010
LANGUAGE = 1
11-
1211
LIVES = 3
12+
13+
1314
TAKEN_GIVEN_DMG_THRESHOLD = 30

readme_images/2021010119113300_c.jpg

231 KB
Loading

readme_images/2021010119115300_c.jpg

233 KB
Loading

readme_images/bottom_limit.png

57.3 KB
Loading

readme_images/top_limit.png

67.9 KB
Loading

resources.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
import numpy
33
import sys
44
from cv2 import cv2
5-
from customizable import res_path, LANGUAGE
5+
from customizable import RES_PATH, LANGUAGE
66
from functions import readTSV, addBackground
77

88

99
MAX_PLAYERS = 4 # Max number of players
1010

1111

12-
CHARACTER_INFOS = readTSV(os.path.join(res_path, "character_references", "characters_info.tsv"))
12+
CHARACTER_INFOS = readTSV(os.path.join(RES_PATH, "character_references", "characters_info.tsv"))
1313
CHARACTER_CLOSEUPS = []
1414
# 2 and 3 players closeups
15-
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(res_path, "character_references", "23-closeups.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
15+
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(RES_PATH, "character_references", "23-closeups.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
1616
tile_height = int(characters_tile.shape[0] / len(CHARACTER_INFOS))
1717
tile_width = int(characters_tile.shape[1] / 8)
1818
main_list = []
@@ -29,7 +29,7 @@
2929
CHARACTER_CLOSEUPS.append(main_list)
3030
CHARACTER_CLOSEUPS.append(main_list)
3131
# 4 players closeups
32-
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(res_path, "character_references", "4-closeups.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
32+
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(RES_PATH, "character_references", "4-closeups.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
3333
tile_height = int(characters_tile.shape[0] / len(CHARACTER_INFOS))
3434
tile_width = int(characters_tile.shape[1] / 8)
3535
main_list = []
@@ -40,15 +40,15 @@
4040
main_list.append(skins_list)
4141
CHARACTER_CLOSEUPS.append(main_list)
4242

43-
CHARACTER_CLOSEUPS_MASKS = [[(cv2.imread(os.path.join(res_path, "character_references", "23-lose_mask.png")) / 255).astype(numpy.uint8),
44-
(cv2.imread(os.path.join(res_path, "character_references", "23-win_mask.png")) / 255).astype(numpy.uint8)],
45-
[(cv2.imread(os.path.join(res_path, "character_references", "23-lose_mask.png")) / 255).astype(numpy.uint8),
46-
(cv2.imread(os.path.join(res_path, "character_references", "23-win_mask.png")) / 255).astype(numpy.uint8)],
47-
[(cv2.imread(os.path.join(res_path, "character_references", "4-lose_mask.png")) / 255).astype(numpy.uint8),
48-
(cv2.imread(os.path.join(res_path, "character_references", "4-win_mask.png")) / 255).astype(numpy.uint8)]]
43+
CHARACTER_CLOSEUPS_MASKS = [[(cv2.imread(os.path.join(RES_PATH, "character_references", "23-lose_mask.png")) / 255).astype(numpy.uint8),
44+
(cv2.imread(os.path.join(RES_PATH, "character_references", "23-win_mask.png")) / 255).astype(numpy.uint8)],
45+
[(cv2.imread(os.path.join(RES_PATH, "character_references", "23-lose_mask.png")) / 255).astype(numpy.uint8),
46+
(cv2.imread(os.path.join(RES_PATH, "character_references", "23-win_mask.png")) / 255).astype(numpy.uint8)],
47+
[(cv2.imread(os.path.join(RES_PATH, "character_references", "4-lose_mask.png")) / 255).astype(numpy.uint8),
48+
(cv2.imread(os.path.join(RES_PATH, "character_references", "4-win_mask.png")) / 255).astype(numpy.uint8)]]
4949

5050
CHARACTER_ICONS = []
51-
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(res_path, "character_references", "icons.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
51+
characters_tile = cv2.cvtColor(cv2.imread(os.path.join(RES_PATH, "character_references", "icons.png"), flags=cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2BGRA)
5252
tile_height = int(characters_tile.shape[0] / len(CHARACTER_INFOS))
5353
tile_width = int(characters_tile.shape[1] / 8)
5454
for i in range(len(CHARACTER_INFOS)):
@@ -96,14 +96,14 @@
9696
SMALL_DIGIT_HEIGHT = 21
9797
SMALL_DIGIT_SEP = 19.5
9898
SMALL_DIGIT_IMAGES = []
99-
digits_tile = cv2.cvtColor(cv2.imread(os.path.join(res_path, "digits", "small_digits.png")), cv2.COLOR_BGR2GRAY)
99+
digits_tile = cv2.cvtColor(cv2.imread(os.path.join(RES_PATH, "digits", "small_digits.png")), cv2.COLOR_BGR2GRAY)
100100
for i in range(11):
101101
SMALL_DIGIT_IMAGES.append(digits_tile[:, i*SMALL_DIGIT_WIDTH : (i+1)*SMALL_DIGIT_WIDTH].copy())
102102

103103
BIG_DIGIT_WIDTH = 44
104104
BIG_DIGIT_HEIGHT = 63
105105
BIG_DIGIT_IMAGES = []
106-
digits_tile = cv2.cvtColor(cv2.imread(os.path.join(res_path, "digits", "big_digits.png")), cv2.COLOR_BGR2GRAY)
106+
digits_tile = cv2.cvtColor(cv2.imread(os.path.join(RES_PATH, "digits", "big_digits.png")), cv2.COLOR_BGR2GRAY)
107107
for i in range(12):
108108
BIG_DIGIT_IMAGES.append(digits_tile[:, i*BIG_DIGIT_WIDTH : (i+1)*BIG_DIGIT_WIDTH].copy())
109109

0 commit comments

Comments
 (0)