Remote Procedure Calls for Kerbal Space Program#

kRPC lets you control Kerbal Space Program from scripts running outside the game. A server inside the game exposes the game’s API, and client libraries call it from Python, C#, C++, C, Java, Lua and JavaScript. Other languages can call it over HTTP, given an HTTP library. It also supports Ferram Aerospace Research, Kerbal Alarm Clock, Infernal Robotics and other popular mods.

This script launches the active vessel straight up, then cuts the engines once it reaches an altitude of 10 km:

import krpc

conn = krpc.connect(name="Launch")
vessel = conn.space_center.active_vessel
flight = vessel.flight()

vessel.auto_pilot.target_pitch_and_heading(90, 90)
vessel.auto_pilot.engaged = True
vessel.control.throttle = 1
vessel.control.activate_next_stage()
print(f"{vessel.name} has launched")

event = conn.add_event(lambda: flight.mean_altitude > 10000)
with event.condition:
    event.wait()

vessel.control.throttle = 0
vessel.auto_pilot.engaged = False
print(f"{vessel.name} reached 10 km")
Getting Started

Install the server plugin, install a client and run your first script.

Getting Started
Tutorials

Complete scripts that launch into orbit, land, dock and draw in the game.

Tutorials
User Guides

How kRPC and the game behave: parts, scenes, time warp, reference frames, streams and more.

User Guides
Clients

The guide and API reference for each client library.

Clients
Developer Guide

Write your own services, implement the protocol, or build kRPC from source.

Developer Guide
Changelog

The changes in each release of kRPC.

Changelog

Clients#

Python
Python
C#
C#
C++
C++
C-nano
C-nano
Java
Java
Lua
Lua
JavaScript
JavaScript
HTTP
HTTP