Parts Browser: How to edit part configurations for RP1 - KSP-RO/RP-1 GitHub Wiki

NOTE: this page has recently been rewritten and it has not yet been verified for accuracy. Use at your own risk.

The parts browser is a browser-based JSON interpreter tool included in the RP-1 source files that facilitates the editing and generation of RP-1 config files. It handles values including tech tree placement, costs, and entry cost modifiers.

1. Initial setup

The part browser has been recently packaged into an executable by mattwrobel. You can find it in the RP-0/Source/Tech Tree/Parts Browser folder under the name "app.exe". To run it, simply download the RP-0 repo, double click on the executable, and then go go to http://localhost:5000/dashboard.

This is what it should look like:

In browser (chrome)

If you can't use the .exe, or want to edit the source code for the part browser itself (not configs!), you can read this section.

2. Editing configs

The full source code for the part browser can be found in the various .py files located at RP-0/Source/Tech Tree/Parts Browser. When run, the program loads the data from the JSON files in RP-0/Source/Tech Tree/Parts Browser/data, and displays the data at http://localhost:5000/dashboard. Upon loading, you will see a home screen - click on "Dashboard" in the top right to view the parts table.

2.1. Parts Table & Editor

The parts table displays a list of all the parts that have RP-1 configurations. At the bottom you can move through the pages and change the number of items per page. Note that selecting a high number of items per page will make the page slow to a crawl. In the header row of the table, the parts can be filtered by a number of different categories. These will allow you to find the parts you wish to change, and then you can then edit the configurations using the "edit" button in the far right column. Additionally, if you are making completely new configs (eg. for a new mod), you can add a new part using the button at the top.

add part

This table lists the various fields and what they do.

Category Description
Name Internal part name used for MM patching (found as name = *** in config files).
Title Part title displayed in game.
Mod Mod from which the part originates.
Cost Purchase cost of the part in game.
Entry Cost Cost of unlocking the part in game. May be affected by ECMs (see below).
RO Value of the RSSROConfig field. Parts configured for RO should have this set in the RO config files. This should be left as what is in the RO config files. If it is not configured the first step is to submit a PR to RO before making RP-1 configs.
RP-0 Sets the value of the RP0conf field. This must be selected, otherwise parts will be marked as non-RP0 and may be either moved to another category (by Filter Extensions) or hidden entirely (by the NoNonRP0 folder).
Category One out of AVIONICS, COMMAND, COMMS, EDL, ELECTRONICS, FLIGHT, HYDROLOX, ION, LS, MATERIALS, NTR, NUCLEAR, ORBITAL, POWER, RCS, SCIENCE, SOLID, SPACEPLANES, STAGED, STATIONS from drop down menu. No effect in game but useful for filtering parts in the parts browser.
Year Real-life year of part. No effect in game (see below for tech tree placement) but useful for filtering parts.
Orphan Sets tech placement to Orphan node for unconfigured parts if checked. All placed parts should leave this unchecked.
Upgrade Used to indicate an engine config upgrade instead of a physical part. Used only for engine configs (mod = Engine_Config) and should not be changed for individual parts.
Entry Cost Mods See ECM section below.
Identical Part See ECM section below.
Engine Config Defines the engine type. This does not have any functionality in game, as engine config definitions and patches are applied from RO, but is useful for finding the same engine from different mods.
Info Any additional notes about the part. No functionality.
Technology Tech tree placement. Must be selected from drop down menu in order to be correctly placed by RP-1. May require research and/or community discussion as to an appropriate placement.
Module Tags Used for KCT rollout cost multipliers. Valid options and their multipliers can be found at RP-0/GameData/RP-0/KCT_Presets/RP1_KCT_Presets.cfg.

2.2. ECMs (Entry Cost Modifiers)

RP-1 supports modifying entry costs for parts depending on what other parts are unlocked. This is done to allow the same part from different mods to become free to unlock if any one of them is unlocked, and also to reduce the cost of parts which share similar technology. For example, unlocking the RD-108 brings the cost of the RD-107 down from ~180,000 to ~10,000.

When writing configs for ECMs, the first thing to do is to find the identical part ID. This is used to identify the same part from different mods and treat them as if unlocking one apply the same ECMs for all. You will then need to define the ECMs for the part. The easiest way to do this is to find the same parts from other mods that are already configured and copying across the values. For example, to configure an engine part as an AJ10-Advanced, searching for all parts with an Engine Config of AJ10_Adv yields the following results: the Identical Part ID in this case is AJ10 (Adv) and the ECM is AJ10-138, so the new part should also use those values.

If there are no similar parts, you don't need to worry about Identical Part IDs, but you may have to write your own ECMs. Be warned: the information on the ECM wiki page contains outdated and incorrect information. Until one of the RP-1 devs comes along and edits this page with a more detailed explanation of the current implementation (cough, cough), it's a bit of a mystery black box. And besides, if you're writing configs for new parts, chances are you're a RP-1 dev and you know what you're doing.

3. Saving your changes

Once you've made your changes, you will see a list appear at the bottom of the page with the queue of changed items.

que up an entry

To make the changes "permanent", you'll need to click "Commit Changes to JSON Files". This will edit the JSON files in RP-0/Source/Tech Tree/Parts Browser/data so that when you load the data from the JSON files next time, the changes will persist. Finally, you need to click "Generate Configs" in the top left. This edits four .cfg files in RP-0/GameData/Tree (TREE-Parts.cfg, TREE-Engines.cfg, ECM-Parts.cfg, and ECM-Engines.cfg) that will actually apply the changes in game. Once you've tested everything and are ready to submit your changes for review, make a fork of the RP-1 repository and then create a pull request.

4. Alternative setup

If the executable doesn't work, you can try running the part browser by installing Python 3, which you can install from here. Make sure that you select "Add Python 3.* to PATH" when running the installer, otherwise you will have to manually add it to PATH in the environment variables. You will then need to install pip by running Python/Python3*-32/Tools/get-pip.py. From there, you will also need Flask and slugify, so run pip install flask and pip install slugify. After that you need to download RP-0 master branch, unzip the whole archive in a separate folder, copy the full path to the file called app.py, which is located in RP-0-master/Source/Tech Tree/Parts Browser. The example of such adress can look like this C:\Users\username\Desktop\my folder\RP-0-master\Source\Tech Tree\Parts Browser (where username is your windows profile's username, my folder is the folder you've created). Next you type in the console cd <path> (where <path> is the path to the app.py file explained earlier without brackets), press enter, then type app.py in the console and press enter again, wait for the thing to finish the process. Congrats! Now go to http://localhost:5000/dashboard.

5. Packaging with PyInstaller

For ease of use, the Parts Browser can be packaged with PyInstaller into a single executable that does not require a local Python installation.

This procedure assumes a functional install of a recent version of Python 3. From a terminal, execute the following:

  1. Create and activate a new virtual environment in the directory <RP-0 repo>/Source/Tech Tree/Parts Browser. On Windows, run the following commands: python -m venv ./ and ./Scripts/activate. You may need to allow PowerShell script execution.
  2. Install the necessary dependencies: python -m pip install flask slugify pyinstaller.
  3. Create the packed executable: python -m PyInstaller --onefile --add-data "templates;templates" ./app.py. Note the capitalization of PyInstaller. (On Unix systems, the semicolon ; should be changed to a colon :.) You may need the additional arguments --paths=. --paths=./Lib/site-packages.
  4. The executable will be found in the dist subdirectory of the parts browser. It can be manually moved out of that directory.
⚠️ **GitHub.com Fallback** ⚠️