C++ compatibility in Rimworld

Started by Rademenes16, July 04, 2020, 07:52:57 AM

Previous topic - Next topic

Rademenes16

Hello,
Is it possible to make a mod based on C++? I know how to use that language so it would be nice to make some use of it.

ToXeye

Unity uses C# so it's not realistically possible. I would just learn the C# language. C++ is great though, but not compatible. Unreal Engine 4 uses C++, if that would interest you.
Features everywhere!
e_  O:
/|   /|\

LWM

Pretend C# is C++ and keep Auntie Google on hand - she can help you with weird syntax.

Oh, and the ?? operator only checks the 2nd operand if the first operand is actually null.

But other than occasional weird syntax and lack of preprocessor macros, you'll be fine.

RawCode

1) pinvoke
2) don't

3) it's possible to write mods in anything, all mods that rely on Harmony and other code injection, are actually based around pure asm.

LWM

Asm? The transpilers use IL, which is basically assembly, but the prefix and postfix don't, so a C-based knowledge can get you really far.

RawCode

you should read sources first and post about CIL second, everything harmony does possible only with ASM injection
(technically same stuff possible with read\write process memory and few other methods but ASM injection is most effective way)

LWM


RawCode

under normal conditions i will give you LMGTFY link with ASM as keyword, but to make answer to your question ever more humiliating i will give you result of it as image:

LWM

Well, someone is acting like an a**hole.

DuckDuckGo doesn't list anything computer science related on the top page; neither does Bing. And that entry certainly wasn't the wiki page google showed me. You're acting as if I didn't search. Do you think I asked if it was in the top results? Please behave politelytowards ppl, eh?

Anyway, to OP: have a go with C#, you'll get along fine, and if you end up needing transpilers, this forum is actually full of helpful people.

RawCode

yes yes in 2020 information is absurdly hard to find and it's always better to just argue with people about things you do not know or understand and suddenly people do not like it.

LWM


Rademenes16

Alright, thanks for explanation. Anyway C# is easy to learn.