Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kel-z committed May 26, 2023
1 parent 48cdbe1 commit cedb801
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 8 deletions.
121 changes: 115 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,118 @@
# Honkai: Star Rail - Data Scanner
Easily export light cones, relics, and character data from Honkai: Star Rail to JSON format using OCR.

## TODO
- [x] Rarity, locked, and equipped attribute for relics
- [ ] Train new OCR model for faster performance.
- [x] async -> multiprocessing (should've been this from the beginning oops)
- [ ] Filter min level/rarity
- [ ] Character scan
## (NOTE: Character export is still under development. Currently, only light cone and relic data can be exported.)

## Installation
If you haven't already, download and install [Microsoft Visual C++ Redistributable for Visual Studio 2015-2022](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022) (x86 or x64 depending on system).

[Download latest HSR Scanner](https://github.com/kel-z/HSR-Scanner/releases/latest) and then run as administrator (required to simulate keyboard and mouse presses).

## Instructions
1. Set in-game resolution to one that has an aspect ratio of 16:9 (e.g. 1920x1080, 1280x720).
<!-- - Changing off from an ultra-wide resolution requires a game restart to reset the UI layout. -->
<!-- ^^ wait... is this a thing in Star Rail? I know it was for Genshin -->
2. **In Star Rail, look away from any bright colours.** The inventory screen is *translucent* and bright colours can bleed through to make the text harder to accurately detect and recognize. Looking towards the ground usually works in most cases, as long as the right side of the screen is relatively dark. (Double-check by opening the inventory page and see if the item info on the right contrasts well with the background.) You can skip this step if you're only scanning characters.
3. Open the cellphone menu (ESC menu).
4. Configure the necessary [scanner settings](#scanner-settings-and-configurations) in HSR Scanner.
5. Start the scan.
- If you have multiple monitors, ensure that both Star Rail and HSR Scanner are on the same monitor before starting the scan.
6. Do not move your mouse during the scan process.
7. Once the scan is complete, additional time may be required to process the data before generating the final JSON file output.

## Scanner settings and configurations
HSR Scanner assumes that the inventory and character key bindings are unchanged ("b" and "c", respectively). If you have modified these bindings, please set them appropriately in the "Configure" tab of HSR Scanner.

HSR Scanner has the following scan options:

- Select whether to scan light cones or relics.
- Set output location for the JSON file.
- Filter light cones and relics based on a minimum rarity or level threshhold (*in development*).

## Output
The output is loosely based off of Genshin's `.GOOD` export format. **Please note that the current output format is subject to change.**
### Notes
- Flat substats and percentage substats are differentiated by an underscore suffix in the key.
- Main stats will never have an underscore suffix.
- The `id` value is arbitrarily assigned during the scanning process. It is intended for easy lookup in case of any errors logged during the scan, for double-checking or manual correction purposes.
- The exact string values can be found in [game_data.py](src/utils/game_data.py).

Current output sample:
```
{
"light_cones": [
{
"name": "Cruising in the Stellar Sea",
"level": 60,
"ascension": 4,
"superimposition": 2,
"location": "seele",
"lock": true,
"id": 0
},
{
"name": "Meshing Cogs",
"level": 1,
"ascension": 0,
"superimposition": 5,
"location": "",
"lock": true,
"id": 1
}
],
"relics": [
{
"setKey": "Celestial Differentiator",
"slotKey": "Planar Sphere",
"rarity": 5,
"level": 15,
"mainStatKey": "Wind DMG Boost",
"subStats": [
{
"key": "HP",
"value": 105
},
{
"key": "CRIT Rate_",
"value": 3.2
},
{
"key": "CRIT DMG_",
"value": 17.4
},
{
"key": "Effect Hit Rate_",
"value": 8.2
}
],
"location": "bronya",
"lock": true,
"id": 2
},
{
"setKey": "Thief of Shooting Meteor",
"slotKey": "Body",
"rarity": 4,
"level": 0,
"mainStatKey": "Outgoing Healing Boost",
"subStats": [
{
"key": "HP",
"value": 30
},
{
"key": "HP_",
"value": 3.4
}
],
"location": "",
"lock": false,
"id": 3
}
]
}
```

## Dev notes
- **Expect data inaccuracies.** This app relies on reading text from images captured during the scan process, as opposed to reading off some save file. It also doesn't help that the inventory screen is translucent, as mentioned in step two of [instructions](#instructions).
- **If you have A LOT of light cones or relics, it could take a few minutes to process the images once the initial scan is done.** The current implementation includes preprocessing and error-checking for each relic to ensure accuracy, which comes at the cost of speed. Since this is my first time working with Tesseract and OCR as a whole, there is a lot of room for improvement and optimization in future releases.
2 changes: 1 addition & 1 deletion src/ui/hsr_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def setupUi(self, MainWindow):
self.groupBox_5.setGeometry(QtCore.QRect(20, 230, 281, 91))
self.groupBox_5.setObjectName("groupBox_5")
self.textEditLog = QtWidgets.QPlainTextEdit(parent=self.groupBox_5)
self.textEditLog.setGeometry(QtCore.QRect(10, 20, 271, 61))
self.textEditLog.setGeometry(QtCore.QRect(10, 20, 261, 61))
self.textEditLog.setReadOnly(True)
self.textEditLog.setObjectName("textEditLog")
self.tabWidget.addTab(self.tab, "")
Expand Down
2 changes: 1 addition & 1 deletion src/ui/hsr_scanner.ui
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>10</x>
<y>20</y>
<width>271</width>
<width>261</width>
<height>61</height>
</rect>
</property>
Expand Down

0 comments on commit cedb801

Please sign in to comment.