kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

Question: Is it possible to port kRPC to Balsa Flight Sim

rallen10 opened this issue ยท 2 comments

commented

I am a user of kRPC for KSP, but not a developer. I have started playing with Balsa Flight Sim and I would love to have a kRPC-like mod for Balsa. I'd be willing to drive some of that development, but would even know where to start. Has anyone looked at porting kRPC to Balsa? Could anyone describe what the "hello world" of a port would even look like to help me figure out a starting point?

commented

the idea of "mods" in things like KSP, is you can write code which interacts with the project itself. (normally via some API which lets you control some parts. sometimes by allowing you real access to everything, and/or hooks and so on.)

the "idea" of kRPC, is that it sits inside KSP as a mod, and in addition is also a server which lets you control kRPC's behavior inside the running KSP - from outside, using the RPC.

so to re-make kRPC for some other project - you will need a whole mod inside that project, a API (which may be similar or even the same as this one, but that doesn't really make sense - lots of things you can do in KSP you cannot in another project and verse-visa),
and a "client" library to allow you to interact: basically something which knows to attach and talk the same API.

as an example to this: lets assume the "game" can is a light bulb, which can be turned on or off.
it lets you write mods in c# which may call a mod API to switch the state on or off.
so you write a mod which opens a TCP port, and lets you send it signals, which cause it to call the mod API, which cause the game to switch the lightbulb.
then you add a library which knows to talk the protocol that the mod exports, and over that you write some script which for example switches the lightbulb every second.

#################
#  GAME         #
#               #
#         +---+ #
#         |mod| #
#         |   | #  +------+
#         |  O+-----O     |
#         +---+ #  |client|
#################  | api  |
                   |      |
                +--+------+--+
                |   script   |
                +------------+

It might make more sense to ask about something like this in balsa's forums (which I assume exist)

good luck!

commented

@yehoshuapw Thank you! That basic explanation really helps scope how kRPC works in relation to KSP (and how it would work if ported to Balsa). Doesn't sound easy, but at least more discernable.