C++ plugin in c#

This plugin is written in c++, and s&box is written in c#, is there anything that can be done so as not to rewrite the code from 0 to c#, but to change the current code a little bit to c++ to c# so that this plugin works in s&box?

1 Like

This ‘plugin’ is written for an entirely different game engine.

1 Like

S&box is currently based on Source 2, they switched off Unreal Engine a bit of time ago.

Recoding C++ to C# wouldn’t be too big of an issue if library equivalent requirements are available, but as @stealthpaw stated, the entire code would have to be rewritten entirely because it’s not S&box’s game engine, Source 2.

2 Likes

IMO you could write a Wrapper in C#, if they allow the Iusage of Interop.

Your maybe best option is to try and compile C++ → WASM → C#. Then you wouldn’t need to worry about allowing unsafe code and you’d still get near-native performance out of it.

Myself and a friend did something similar for Gmod but never got it to work extremely well, because LuaJIT is touchy about what it will JIT and has hard limits on local variable count and jump offset length that you run into with larger functions. It would probably be way more straightforward with C#.

I’d consider pursuing this kind of project myself but I’ve already got too much on my plate.

1 Like