Skip to content

Development

If you're interested in helping out, CPAH is an open source project and I welcome bug reports, suggestions, and merge requests!

Running from source

If you'd like to run CPAH from source and you're on Windows, install git and Python 3.7, then execute the following in PowerShell (CMD should work but we live in the future):

PS> git clone https://gitlab.com/jkchen2/cpah.git
PS> cd cpah
PS> python -m pip install poetry
PS> python -m poetry install
PS> python -m poetry shell
PS> python entrypoint.py

Compiling

To freeze CPAH to a binary, follow the above steps for running from source (sans the last line), create a new file in the project directory named VERSION with the version text in it, and run:

PS> poetry install --extras build
PS> pyinstaller cpah.spec

Linting

To lint code, follow the above steps for running from source (sans the last line), and run:

PS> poetry install --extras lint
PS> black cpah tests
PS> mypy cpah tests

Testing

To run tests, follow the above steps for running from source (sans the last line), and run:

PS> poetry install --extras test
PS> pytest --black --mypy cpah tests

Documentation

To build docs, follow the above steps for running from source (sans the last line), and run:

PS> poetry install --extras docs
PS> mkdocs serve

Then visit http://localhost:8000 for the MkDocs generated documentation.

CI Pipeline

CPAH is built and released using GitLab's CI pipeline.

To access the builds from a certain branch, visit the pipelines page, then filter by branch name. Select the build stage of the desired pipeline run:

filter

On the information bar on the right side under Job artifacts, select Browse:

browse

The binary is located under the dist directory:

artifact

Adding languages

While the CPAH program itself is fixed to English, it can be configured to analyze screenshots of Cyberpunk running in other languages.

Currently, the following analysis languages are supported (not all daemons may be supported):

Language Notes
العربية Missing quest daemons
Deutsch Missing some quest daemons
English
Español Missing quest daemons
Français Missing quest daemons
Italiano Missing quest daemons
日本語 Missing quest daemons
한국어 Missing quest daemons
Polski Missing quest daemons
Português Missing quest daemons
Русский Missing quest daemons
简体中文 Missing some quest daemons

In order to add new language support (or augment existing support), several template images will need to be saved for each part of the breach protocol screen, and translations for daemons will have to be added to a file.

Template images

Warning

Before creating template images, there are some hard requirements. The game must be running at 1080p and a screenshot of the game window must be in 1920x1080. Additionally, the gamma correction must be set to 1 (the default). Screenshots must be in lossless quality. All template images should have consistently 2 to 3 pixels bordering the content (unless there is no room).

Datamine v1, v2, and v3 daemons may have a hard time being detected at lower resolutions. It may be better to create a template image of the numeric portion of the name instead.

borders

Below is an example of a proper screenshot with template image regions labeled:

labels

Color Filename Example Required?
Red title_breach.png title_breach Required
Cyan title_buffer.png title_buffer Required
Yellow title_sequences.png title_sequences Required
Purple daemon_<name>.png daemon_datamine_v1 Optional -- list of daemon names below
Orange code_<index>.png code_0 May be optional -- see below
Blue code_<index>_small.png code_0_small May be optional -- see below

Daemons

Note

Not all daemon template images need to be included. The common ones and the perk unlocked ones are good to include, but CPAH should still be able to handle daemons that aren't included by labeling them as "unknown".

Filename Image Daemon type
daemon_datamine_v1.png datamine_v1 Common
daemon_datamine_v2.png datamine_v2 Common
daemon_datamine_v3.png datamine_v3 Common
daemon_icepick.png icepick Common
daemon_mass_vulnerability.png mass_vulnerability Perk unlocked
daemon_camera_shutdown.png camera_shutdown Perk unlocked
daemon_friendly_turrets.png friendly_turrets Perk unlocked
daemon_turret_shutdown.png turret_shutdown Perk unlocked
daemon_optics_jammer.png optics_jammer Legendary: Reboot Optics
daemon_weapons_jammer.png weapons_jammer Legendary: Weapon Glitch
daemon_datamine_copy_malware.png datamine_copy_malware Quest: The Pickup
daemon_neutralize_malware.png neutralize_malware Quest: The Pickup
daemon_gain_access.png gain_access Quest: Space Oddity
daemon_datamine_crafting_specs.png datamine_crafting_specs Quest: Spellbound

Note

When screenshotting daemons, take note of the gap size between daemon names and codes. If the gap size is larger or smaller than the default (70-71 pixels), it must be specified in the meta.json file with a daemons_gap_size key as a float.

For example, the daemons gap size for Simplified Chinese is 62 pixels: daemons_gap_size

See the example meta.json file for Simplified Chinese below for more.

Codes

Note

Code images are only required if your language changes the appearance of the codes compared to English. For example, there are some subtle differences between the code appearance in English vs simplified Chinese:

English Simplified Chinese
en_code_1 en_code_2 en_code_3 en_code_1_small en_code_2_small en_code_3_small cn_code_1 cn_code_2 cn_code_3 cn_code_1_small cn_code_2_small cn_code_3_small

Note

When making code template images, be sure to only use codes that aren't under the first row or column highlight. code_screenshot

Filename (normal) Filename (small) Image (normal) Image (small)
code_0.png code_0_small.png code_0 code_0_small
code_1.png code_1_small.png code_1 code_1_small
code_2.png code_2_small.png code_2 code_2_small
code_3.png code_3_small.png code_3 code_3_small
code_4.png code_4_small.png code_4 code_4_small
code_5.png code_5_small.png code_5 code_5_small

Metadata file

In addition to the images described above, a metadata file needs to be written, named meta.json. This file should contain the name of the language that shows up in the UI, as well as the text content for the daemons of the template images. Like before, these translations aren't mandatory, but should be provided if possible. For example:

{
    "name": "English",
    "daemons": {
        "datamine_v1": "DATAMINE_V1",
        "datamine_v2": "DATAMINE_V2",
        "datamine_v3": "DATAMINE_V3",
        "icepick": "ICEPICK",
        "mass_vulnerability": "MASS VULNERABILITY",
        "camera_shutdown": "CAMERA SHUTDOWN",
        "friendly_turrets": "FRIENDLY TURRETS",
        "turret_shutdown": "TURRET SHUTDOWN",
        "optics_jammer": "OPTICS JAMMER",
        "weapons_jammer": "WEAPONS JAMMER",
        "datamine_copy_malware": "DATAMINE: COPY MALWARE",
        "neutralize_malware": "NEUTRALIZE MALWARE",
        "gain_access": "GAIN ACCESS",
        "datamine_crafting_specs": "DATAMINE: CRAFTING SPECS"
    }
}
{
    "name": "简体中文",
    "daemons_gap_size": 62.0,
    "daemons": {
        "datamine_v1": "数据挖掘_V1",
        "datamine_v2": "数据挖掘_V2",
        "datamine_v3": "数据挖掘_V3",
        "icepick": "冰锥",
        "mass_vulnerability": "集体薄弱",
        "camera_shutdown": "摄像头关闭",
        "friendly_turrets": "友方炮塔",
        "turret_shutdown": "炮塔关闭",
        "optics_jammer": "义眼妨碍",
        "weapons_jammer": "武器妨害",
        "gain_access": "获取权限"
    }
}

File structure

When both the template images and metadata file are ready, they can be added to a new directory under cpah/resources/images/languages. The new directory name should be the language tag, with an optional sub-code if necessary.

file_structure

When all data has been combined, feel free to either send in the data as an attachment on an issue in the tracker, or submit your own merge request.