Modding in C# feels incredibly boring and tedious.

TheGrainMan

Recruit
Best answers
0
I am also learning C# to try and mod Bannerlord and I have to agree with OP's assessment of the language. Coming from Python, Lisp, even C it seems like a TON of boilerplate to do even simple tasks. If I understand the paradigm correctly, in order to mod any feature you have to override the entire class? What a waste. In Python for example, you can just monkey patch in a specific method or attribute and avoid blasting an entire base class. Seems overriding classes is just going to create unnecessary conflicts between mods and between different versions. The whole public/private layout of the code I have viewed so far in dotPeek seems arbitrary and entirely unnecessary. Tons of getters and setters that do nothing but retrieve an attribute or set that attribute.
 

abc123456

Regular
Best answers
0
I am also learning C# to try and mod Bannerlord and I have to agree with OP's assessment of the language. Coming from Python, Lisp, even C it seems like a TON of boilerplate to do even simple tasks. If I understand the paradigm correctly, in order to mod any feature you have to override the entire class? What a waste. In Python for example, you can just monkey patch in a specific method or attribute and avoid blasting an entire base class. Seems overriding classes is just going to create unnecessary conflicts between mods and between different versions. The whole public/private layout of the code I have viewed so far in dotPeek seems arbitrary and entirely unnecessary. Tons of getters and setters that do nothing but retrieve an attribute or set that attribute.
To be fair, python,Lisp and C were not designed for complex gameplay programming. Can you imagine writing gameplay code in Unreal Engine 4 with these languages? It would be a nightmare. C# is the right choice because it offers scalability and maintainability of complex code but has a much easier learning curve than C++. Out of all the object oriented programming languages out there that offers a balance of scalability and ease of use, C# strikes the right balance. I agree there might be more boilerplate for some cases compared to say Python, but you have to understand we need to cater for all kinds of projects large or small. Every language has its weaknesses and strengths and we can't please everyone for all cases. If you are making a small and simple mod, then C# is overkill but if you are making a complex overhaul, then C# is the way to go... or C++ or even Rust.
 

TheGrainMan

Recruit
Best answers
0
To be fair, python,Lisp and C were not designed for complex gameplay programming. Can you imagine writing gameplay code in Unreal Engine 4 with these languages? It would be a nightmare. C# is the right choice because it offers scalability and maintainability of complex code but has a much easier learning curve than C++. Out of all the object oriented programming languages out there that offers a balance of scalability and ease of use, C# strikes the right balance. I agree there might be more boilerplate for some cases compared to say Python, but you have to understand we need to cater for all kinds of projects large or small. Every language has its weaknesses and strengths and we can't please everyone for all cases. If you are making a small and simple mod, then C# is overkill but if you are making a complex overhaul, then C# is the way to go... or C++ or even Rust.
Eh I'm not really impressed by what I've seen so far. There's entire DLLs in Bannerlord of several hundred lines that could be boiled down to basically a C struct. I think this language forces you to over engineer everything. I agree about it being easier to use than C++ though. If it was C++ or Rust I wouldn't even bother to try.
 
Best answers
0
Eh I'm not really impressed by what I've seen so far. There's entire DLLs in Bannerlord of several hundred lines that could be boiled down to basically a C struct. I think this language forces you to over engineer everything. I agree about it being easier to use than C++ though. If it was C++ or Rust I wouldn't even bother to try.
That is because you are reverse engineering a DLL and you are not getting the code as it was written. If the original code is released for modding purposes, I would hope that they wrote it using the proper tools (such as inheritance and all that fun stuff). And if they don't, that's on who wrote the code, not the language.

Then of course we all have languages that we like and languages that we don't like (and we usually prefer what we started writing code in). But rest assured, what you are going through now is made much worse than it needs to be by the fact that we don't have proper modding tools.
 

Kentucky James VII

BioAfrikaner
Duke
Best answers
2
Decompiled code doesn't change the structure of classes or methods, so if there are bad practices like those mentioned above they're going to be in the actual source code as well.
 

Dusk Voyager

Count
Best answers
0
I have to say C# is a massive improvement. Sure, I liked Monty/MABL's ease of use and quirks that allowed for out-of-the-box thinking and gimmicks a lot, but the same dependence on gimmicky workarounds limited it greatly (having to rely on parties or troop inventories to simulate arrays, no way to work with strings apart from joining them together and some other stuff that should have been trivial otherwise). Monty just can't handle such a supposedly ambitious game. It's not 2012 anymore.

Not to mention it allowed for a limited amount of scripts/tuples, making it harder to read and work with. With C#, you can create as many functions, classes or objects as you like, organizing your code better. It's also supported by a lot of common IDEs, which helps with debugging and reviewing.
 

metafa

Sergeant
M&BWBWF&SNWVC
Best answers
0
This thread feels incredibly boring and tedious. I programmed in dozens of modding languages over the past 2 decades. Where you have prominent languages with massive amounts of threads on the Internet about and where they are as advanced and high-level like C# you get stuff done. Period.