Non-readable code

A huge advantage/disadvantage of Lua was that you could very easily reverse engineer/steal code from other scripts and use it to learn from/rip off others. Will our code addons in C# be in a non-decompilable (encrypted?) format? Sorry if this is a noob question, i’m not familiar with C# reverse engineering in general.

Not by default and not by us. There’s ways to obfuscate your code but I wouldn’t recommend it, it’s generally more trouble than it’s worth,

2 Likes

and even if it would be encrypted/obfuscated there would be ways to undo it sooner or later

if someone wants your (non serverside) code they will get it

You’ll need to look into C# Obfuscation yourself as with Lua. There is already a wide range of tools out there for you to learn this.

1 Like

Just to clarify. I’m all against closed source solutions, drms, and obfuscated code. I’m more expressing my worries than hopes.

There’s a few tools that will help, I’m unsure if ILSpy is one to look at here, I’m unsure what framework the game would be using. Just because .net is very much popular within C#, it’s not yet obvious to me in this case

1 Like

I see no issue with closed source solutions imo.

Developers should be able to protect their code if they so choose to.

2 Likes

If the code is client side there’s always going to be a way to get it. You can still keep your server side code private.

10 Likes

If you want something closed source then just keep the server side code to yourself, any effort spent on trying to obfuscate it is probably better spent elsewhere anyways because you’re just fighting a losing battle at that point.

Or you can just open source it and save yourself the trouble by letting people learn from your work and encouraging them to do the same.

Not everyone codes for fun or only for their own server. Selling your work will be a thing in S&Box. But you are right, it’s a cat and mouse game.

1 Like

Another reason why communism always ends in failure

5 Likes

Most people who actually work on addons eventually learn that the value is also offered in the support for people who buy it. There’s a reason many server owners still buy scripts from gmod store even though they’ve been leaked plenty of other times in certain places.

We’re definitely going to get people trying to obfuscate their code, but considering c# is just an interpreted language, it’s not going to be comparable to something similar to other compiled languages (Which, as i would point out; a ton of reverse engineering tools exist for)

I’m personally looking forward to making dynamic patches to fix other’s buggy addons during runtime, since reflection is a thing in c# we can leverage, it’s going to be interesting.

1 Like

This is the wrong attitude to have. People will buy your addon if it’s good and provide good support.

9 Likes

The server/clientside code is a bit confusing to me, like can you select methods/variables in a class to not replicate? Are they two different code bases?

MyObfuscatedAddon.zip

\..
\PluginLoader.cs
\MyAddonServer.dll
\MyAddonClient.dll

PluginLoader.cs // only installed on server

public class PluginLoaderAddon : Addon
{
   public override void Load()
   {
       var serverAsm = Assembly.LoadFrom("MyAddonServer.dll");
       LoadAddonFromAssembly(serverAsm);  

       var clientAsm = Assembly.LoadFrom("MyAddonClient.dll");
       SendAddonAssemblyToClient(clientAsm);
   }
}

Obviously MyAddonServer.dll and MyAddonClient.dll would be obfuscated here.

Seems like a viable option, just worried about the performance implications this might have.
Of course if theres say thousands of addons having something like that implemented would just slow things down significantly because we would have to de-encrypt or de-obfuscate each addon everytime its loaded.
Then again performance impact could depend on how well the de-obfuscation and obfuscation code is implemented.

Obfuscated assemblies are not decrypted/deobfuscated and run as is, it just makes the code much more unreadable. Hence it has little impact on performance. However some obfuscators create their own VMs and bytecode, these would indeed have an impact on performance.

That is a really good point. That is exactly why people buy for example RP printer plugins in gmod instead of downloading something that is free that is similar.

1 Like