#
kRPC2 allows you to control Kerbal Space Program 2 from scripts running outside of the game, and comes with client libraries for many popular languages.
This is a continuation of the kRPC mod for Kerbal Space Program 1, which can be found here: https://github.com/krpc/krpc
Requires SpaceWarp/BepInEx to be installed.
Download the release archive and extract it into the BepInEx folder.
The mod is a very early work in progress, so don't expect much!
Currently there is a single "service", called SpaceCenter2, with a few properties for basic telemetry.
It works with the existing kRPC client libraries (as it speaks the same protocol). However we don't yet provide generated stubs for clients like C++, C# and Java. It has only been tested using the python client, which does not require generated stubs (it can auto-generate them on connection).
When the game starts, a server is created with RPC port 50000 and Stream port 50001. There is no configuration for this yet - it is hard coded in.
Here's an example in Python, with all the currently available telemetry:
import krpc
conn = krpc.connect()
print(conn.space_center2.active_vessel.orbit.eccentricity)
print(conn.space_center2.active_vessel.orbit.apoapsis)
print(conn.space_center2.active_vessel.orbit.periapsis)
This mod is in the early stages of development - there is lots to do and help is greatly appreciated!
Also check out the contribution guide (for kRPC1, but still applies here).
lib/ksp2
to where you have Kerbal Space Program 2 installed, so that you have lib/ksp2/KSP_x64_Data/Managed/...
bazel build //:krpc2
bazel-bin/krpc2-VERSION.zip
Using Bazel:
%ProgramData%/bazel.bazelrc
containing the following:
startup --output_user_root="C:/bazel-root"
lib/ksp2/KSP_x64_Data/Managed/...
)bazel build //:krpc2
bazel-bin/krpc2-VERSION.zip
Using Visual Studio:
bazel build //:csproj
. This puts all the required files in bazel-bin/csproj/...
KRPC2.sln
.