Sign in to follow this  
The Pink Ranger

Can you use other languages besides C# to write plugins for KSP?

Recommended Posts

Hey fellas the only experience I have with programming is a single semester of basic C++. Anyway I'm basically trying to find ways to merge work and play and was wondering if it's at all possible to write a plugin for KSP in C++. Thanks.

Share this post


Link to post
Share on other sites

You could probably use any .net language, but not C++. There are ways to call into C++ from C# - see http://stackoverflow.com/questions/18997672/calling-unmanaged-c-from-c-sharp - but you'd almost certainly be better off just working entirely in C#.

It's not that hard to pick up some C# for KSP modding. I'd suggest just going for it - or if you don't want to confuse your C++ habits, something like F#.

Share this post


Link to post
Share on other sites

Use C#. A plugin in c++ will still need a c# wrapper and it would also require different version for windows, OSX and linux. Let others handle the c++ insanities.

Share this post


Link to post
Share on other sites
You could probably use any .net language, but not C++. There are ways to call into C++ from C# - see http://stackoverflow.com/questions/18997672/calling-unmanaged-c-from-c-sharp - but you'd almost certainly be better off just working entirely in C#.

It's not that hard to pick up some C# for KSP modding. I'd suggest just going for it - or if you don't want to confuse your C++ habits, something like F#.

you can compile C++ to a .NET dll but you'll need to write managed C++

Share this post


Link to post
Share on other sites

Managed C++ is called c++/cli now for some reasons. It is important to note that afaik Mono can only handle pure .net assemblies (c++/cli allows some crazy .... with native libraries, but that's platform depended [=bad] and tricky to realize). That means you would have to exclusively rely on manged libraries, preferably the .NET Framework Class Library. That's like learning a new language, and thus not much harder to switch to c#. I think there were also some issues [though resolvable] with creating c++ assemblies for .net 3.5. Also pretty much all "reference" code (other mods) are in C#, so you should be able to read c# anyway.

tl;dr C++ KSP modding is not worth it. Use/learn C#.

Share this post


Link to post
Share on other sites

Okay thanks guys. I'd like to learn C# eventually but I'm really just trying to sharpen up my C++ skills while doing something fun in the process. Too bad because modding KSP looks like a lot of fun. Anyway thanks for being helpful, wasn't expecting it haha.

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this