krpc / krpc2

Remote Procedure Calls for Kerbal Space Program 2
Other
46 stars 3 forks source link

Notice: I (djungelorm) am not actively developing this. If you would like to contribute PRs or take over the project please get in touch on Discord.

#

kRPC2 - Remote Procedure Calls for Kerbal Space Program 2

ci

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

Links for more info

Installing

Requires SpaceWarp/BepInEx to be installed.

Download the release archive and extract it into the BepInEx folder.

Current Status

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)

Development

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).

Building on Linux

Building on Windows

Using Bazel:

Using Visual Studio: