Modding in C# feels incredibly boring and tedious.

Users who are viewing this thread

Unpopular opinion : I strongly prefer the Warband MS, as it was possible to add some incredible features in only a handful of hours.

It would take days to add the same things in Bannerlord. And the sealed Hero/Characters (and so on) classes add up to the mess if we want to create features intensive mods.

After 2 days using dotpeek, I fear that in the current state of things, we won't see any interesting concept because it is far too hard to implement, even if it is in theory possible.

Taleworlds wanted to go too fast, too far. In the end, we have an unfinished and bugged product that is clearly not optimized for modding. I've seen incredible and frightening things in the code.

What do you think?
 
No offense, MB array programming is absolute hack job. Warban modding could be much better if they picked a proven simple scripting runtime such as Lua or even small embedded python/JS.
Current modding state is like this, because dev are not going ro release documentation/sdk until it reached release build. The intention of this, because they're testing the game and mods can interfere with their bug hunting process
 
I really really liked the old warband scripting langage. I agree with you, once you get how it worked, you could easily add game changing features. It's too early for me to judge the new system, although adding new troops is a breeze with XML, really easy, both to do and to understand.
As for C#, I am in the process of learning this waste of a langage, they made the worst choice ever IMHO. However, there is an incredible amount of great tuts on the net, and well, I have free time on my hands... However, going through the DLL's, the amount of tweaks is huge, and I can't wait to learn more to be able to add new features.
And lastly, I think people complain, but in this case, they should just set the game aside, and come back in a year or so when it's done.
 
I really really liked the old warband scripting langage. I agree with you, once you get how it worked, you could easily add game changing features. It's too early for me to judge the new system, although adding new troops is a breeze with XML, really easy, both to do and to understand.
As for C#, I am in the process of learning this waste of a langage, they made the worst choice ever IMHO. However, there is an incredible amount of great tuts on the net, and well, I have free time on my hands... However, going through the DLL's, the amount of tweaks is huge, and I can't wait to learn more to be able to add new features.
And lastly, I think people complain, but in this case, they should just set the game aside, and come back in a year or so when it's done.
Wtf C# is used everywhere, meanwhile MB array is just a domain specific language that only runs on Warband. It's ugly and slow.

It's good investment. Learning C# while also learn how to follow program flow, .net reverse engineering, etc
 
Wtf C# is used everywhere, meanwhile MB array is just a domain specific language that only runs on Warband. It's ugly and slow.

It's good investment. Learning C# while also learn how to follow program flow, .net reverse engineering, etc

C# modding actually also helps the devs even without documentation to find bugs very specifically inside their own code.
 
I really really liked the old warband scripting langage. I agree with you, once you get how it worked, you could easily add game changing features. It's too early for me to judge the new system, although adding new troops is a breeze with XML, really easy, both to do and to understand.
As for C#, I am in the process of learning this waste of a langage, they made the worst choice ever IMHO. However, there is an incredible amount of great tuts on the net, and well, I have free time on my hands... However, going through the DLL's, the amount of tweaks is huge, and I can't wait to learn more to be able to add new features.
And lastly, I think people complain, but in this case, they should just set the game aside, and come back in a year or so when it's done.

Waste of a language, worst decision ever? Care to elaborate why? Using C# is a massive improvement.
 
The warband MS was a joke, it didn't even support floats or arrays or structs or any of the vital stuff you need to make even the simplest systems. If the MS forces you to turn a fake troop into a struct or use global variables to pass outputs, something is wrong. It wasted a lot of memory and was awful to use.

What's more the pointless use of brackets and commas made it easy to get errors. Look at this:

(store_add, ":foo", ":bar", 53),

Now in a C based language:

int foo = bar + 53
 
Well, as far as I am concerned, and having toyed around with other langages or dedicated langages (godot, lua, python, warband...), C# is stupidly confusing to me. I am discovering the langage oc, but the simple fact of having so many different parameters when you create functions (or "methods" if I understand well, is stupid imho. WTF public, private, serialized, whatever, I just want to create a damn function, like in so many other langages. ANd then, classes, methods, various types of same variables (float, double...int, int32, and so on), its just bull****. Having to create a variable, then, creating again (new whatever), I find this stupid. In so many other langages, I just freaking create a function, and can use it right amay. However, I am using VB, and I am amazed by the number of qol systems.
I must get use to it anyways, no choice, but so far, I really don't like it, and find it overly complicated.
@ Kentucky James VII
I know, I must have written thousands of lines for warband (I created the Rigale Mod, which was, as a matter of fact, quite heavy on new systems...)

Now you guys are probably really happy because you already know C#, great on yall :smile:
 
Last edited:
Well, as far as I am concerned, and having toyed around with other langages or dedicated langages (godot, lua, python, warband...), C# is stupidly confusing to me. I am discovering the langage oc, but the simple fact of having so many different parameters when you create functions (or "methods" if I understand well, is stupid imho. WTF public, private, serialized, whatever, I just want to create a damn function, like in so many other langages. ANd then, classes, methods, various types of same variables (float, double...int, int32, and so on), its just bull****. Having to create a variable, then, creating again (new whatever), I find this stupid. In so many other langages, I just freaking create a function, and can use it right amay. However, I am using VB, and I am amazed by the number of qol systems.
I must get use to it anyways, no choice, but so far, I really don't like it, and find it overly complicated.
@ Kentucky James VII
Sure, but I managed to create a bunch of various systems with it.
Now you guys are probably really happy because you already know C#, great on yall :smile:


Welcome, brother :grin:
 
C# : private Dictionary<string, string> testDictionary = new Dictionary<string, string>();
Godot : var testDictionary = {}

InformationManager.DisplayMessage(new InformationMessage("Blah blah."));
In any prog langage I know, you don't have "new InformationMessage". You just add the godammn message, and don't have to tell to create a "new" message. Bull****.

So of course I will get used to it, but please don't tell me this is, for a basic and self taught coder like myself, in any way an improvement.
 
Last edited:
I do understand the replies stating that it is a far better programming langage overall, and I'm not against that.

The problem that I see is that it seems very easy to add tweaks, but it would be extremely hard for example to modify the individual combat AI, the spawn of a party, the properties of the hero class, the formula to output damages when in warband it was extremely simple.

I am worried for many reasons, but also because they designed some systems to be incredibly black box and difficult to tweak such as the melee damage output in the code. If you fiddle with it, you will see a bunch of goto functions, of variables defined one after the other and it doesn't seem that it can be modified easily without using harmony. Seriously??


public static float CalculateStrikeMagnitudeForSwing(
float swingSpeed,
float impactPointAsPercent,
float weaponWeight,
float weaponLength,
float weaponInertia,
float weaponCoM,
float extraLinearSpeed)
{
float num1 = weaponLength * impactPointAsPercent - weaponCoM;
float num2 = swingSpeed * (0.5f + weaponCoM) + extraLinearSpeed;
double num3 = 0.5 * (double) weaponWeight * (double) num2 * (double) num2;
float num4 = swingSpeed;
double num5 = (double) (0.5f * weaponInertia * num4 * num4);
double num6 = num3 + num5;
float num7 = (float) (((double) num2 + (double) num4 * (double) num1) / (1.0 / (double) weaponWeight + (double) num1 * (double) num1 / (double) weaponInertia));
float num8 = num2 - num7 / weaponWeight;
float num9 = num4 - num7 * num1 / weaponInertia;
float num10 = 0.5f * weaponWeight * num8 * num8 + 0.5f * weaponInertia * num9 * num9;
double num11 = (double) num10;
double num12 = num6 - num11;
float num13 = num10 * 0.5f;
return 0.067f * (float) (num12 + 0.5);
public static float CalculateStrikeMagnitudeForThrust(
float thrustWeaponSpeed,
float weaponWeight,
float extraLinearSpeed,
bool isThrown)
{
float num = thrustWeaponSpeed + extraLinearSpeed;
if (!isThrown)
weaponWeight += 2.5f;
return 0.125f * (0.5f * weaponWeight * num * num);
}
public static float ComputeRawDamageNew(
DamageTypes damageType,
float magnitude,
float armorEffectiveness,
float absorbedDamageRatio)
{
float num1 = 0.0f;
float factorByDamageType = CombatStatCalculator.GetBluntDamageFactorByDamageType(damageType);
float num2 = magnitude * factorByDamageType;
float num3 = (float) (100.0 / (100.0 + (double) armorEffectiveness));
float num4 = num1 + num2 * num3;
float num5;
switch (damageType)
{
case DamageTypes.Cut:
num5 = Math.Max(0.0f, (float) ((double) magnitude * (double) num3 - (double) armorEffectiveness * 0.5));
break;
case DamageTypes.Pierce:
num5 = Math.Max(0.0f, (float) ((double) magnitude * (double) num3 - (double) armorEffectiveness * 0.330000013113022));
break;
case DamageTypes.Blunt:
label_5:
return num4 * absorbedDamageRatio;
default:
return 0.0f;
}
num4 += num5 * (1f - factorByDamageType);
goto label_5;
}
private static float GetBluntDamageFactorByDamageType(DamageTypes damageType)
{
float num = 0.0f;
switch (damageType)
{
case DamageTypes.Cut:
num = 0.1f;
break;
case DamageTypes.Pierce:
num = 0.25f;
break;
case DamageTypes.Blunt:
num = 1f;
break;
}
return num;
}

Well this looks incredibly bad to me, on top of the fact that it is not easily modifiable. And it is just a small part of the code for damage output calculation in melee. And it is also not balanced, because cutting damage will deal natively less damages than piercing damages because of the wrong formulae they implemented, spears will be overpowered when swung from a horse and so on and so forth.

So they decided to "fix" the problem by implementing a multiplier of damages of every blade of the game that you can build in the forge (you can see that in the xml files). If you know how to code, this is INCREDIBLY bad design. I'm really afraid that most of the code is difficult to read, difficult to modify and not balanced at all.

It is really good to try to simulate the physical properties of the real world, the economy etc etc but please do that when you have some knowledge in that, not just when you like fiddling around with wrong numbers and terrible simulations... And C# doesn't help by being the most difficult language to read for many reasons, with a really convoluted syntax for many things.

This game is not horribly bad, but it looks like they ported the code of warband to a better architecture but they understood that their architecture was actually really bad to make further progress (for example, dialogs with characters are boring and rare, and it is because their system to implement them looks just so wrong...). I must admit that having all the dialogs in one file in warband was much more convenient.
 
The problem that I see is that it seems very easy to add tweaks, but it would be extremely hard for example to modify the individual combat AI, the spawn of a party, the properties of the hero class, the formula to output damages when in warband it was extremely simple.

That has more to do with the way the code is implemented than the language itself. The code you posted above is truly horrible to read and there are much less obnoxious ways of implementing it.

I wouldn't be surprised if this was what the warband code looked like as well, since weapon damage calculation wasn't exposed in the MS, neither was combat AI or even the random number system (which was also broken).
 
C# : private Dictionary<string, string> testDictionary = new Dictionary<string, string>();
Godot : var testDictionary = {}

InformationManager.DisplayMessage(new InformationMessage("Blah blah."));
In any prog langage I know, you don't have "new InformationMessage". You just add the godammn message, and don't have to tell to create a "new" message. Bull****.

So of course I will get used to it, but please don't tell me this is, for a basic and self taught coder like myself, in any way an improvement.
nobody stopping you to ship IronPython/Jint into bannerlord and forget the C# stuff and code entirely in Python/Javascript
 
just use a IDE with support to TW libraries and their XML templates.

You dont need to type all that

The IDE checks the syntax for you

You are not suppose to code C# with Notepad :razz:

Look at how many people gave up on MBScript over the decade. C# is not the problem. Coding is. Coding is scary for newbies. Just keep going and in a few months you will not even remember the pains of learning it.

And if you just dont like the syntax itself ... use a decorator language. Its not like you need to use basic C# if you dont want to.
 
Technically C# is an upgrade from what MB had but its still outdated and bogged down for a modern game. Its disappointing but we still should, should get better mods with this game unless for some reason this current .DLL nonsense isnt just from not having an official modding tool...lol, requiring a .DLL is worst idea ever for modding and about as big of a risk to a persons computer as any other file type and no company should ever be making a game based on modding that uses them.
 
C# : private Dictionary<string, string> testDictionary = new Dictionary<string, string>();
Godot : var testDictionary = {}

InformationManager.DisplayMessage(new InformationMessage("Blah blah."));
In any prog langage I know, you don't have "new InformationMessage". You just add the godammn message, and don't have to tell to create a "new" message. Bull****.

So of course I will get used to it, but please don't tell me this is, for a basic and self taught coder like myself, in any way an improvement.

In C# every variable is private by default and you can use "var" in C# too, so your example became:
var testDictionary = new Dictionary<string,string>();
Now everyone who read your code know what testDictionary is, when "var testDictionary = {}" could be anything.

You are also confusing the language (c#) with Bannerlord code.
Devs could build a static class called Messages, with a method "Show" and the result code for display message would be:
Messages.Show("Hello");

If InformationManager is a static class, you could build a similar method yourself:
C#:
void SendMessage(string message){
    InformationManager.DisplayMessage(new InformationMessage(message));
}
and use:
SendMessage("Hello");
in your code.
 
Now everyone who read your code know what testDictionary is, when "var testDictionary = {}" could be anything.
well, once you know that {} is only meant for dictionnaries...and I really don't think that C# is meant to be casually read by anybody...And godot and other langages dic can store almost anything without having to define the types of values first...
Thanks a lot anyways. I am learning a lot by reading other people's code already. And there are great tuts all over the place, so I should be fine.
 
Sorry, i don't know godot and i assumed it was an empty array.

I'm also a self taught coder myself and english is not my native language, so i've some trouble to explain why c# is a great language once you've learn it. I can only suggest to use Visual Studio Community: intellisense with autocompletition, suggestions etc helps a lot (and this tooling works because c# is strongly-typed) .
 
I do understand the replies stating that it is a far better programming langage overall, and I'm not against that.

The problem that I see is that it seems very easy to add tweaks, but it would be extremely hard for example to modify the individual combat AI, the spawn of a party, the properties of the hero class, the formula to output damages when in warband it was extremely simple.

I am worried for many reasons, but also because they designed some systems to be incredibly black box and difficult to tweak such as the melee damage output in the code. If you fiddle with it, you will see a bunch of goto functions, of variables defined one after the other and it doesn't seem that it can be modified easily without using harmony. Seriously??


public static float CalculateStrikeMagnitudeForSwing(
float swingSpeed,
float impactPointAsPercent,
float weaponWeight,
float weaponLength,
float weaponInertia,
float weaponCoM,
float extraLinearSpeed)
{
float num1 = weaponLength * impactPointAsPercent - weaponCoM;
float num2 = swingSpeed * (0.5f + weaponCoM) + extraLinearSpeed;
double num3 = 0.5 * (double) weaponWeight * (double) num2 * (double) num2;
float num4 = swingSpeed;
double num5 = (double) (0.5f * weaponInertia * num4 * num4);
double num6 = num3 + num5;
float num7 = (float) (((double) num2 + (double) num4 * (double) num1) / (1.0 / (double) weaponWeight + (double) num1 * (double) num1 / (double) weaponInertia));
float num8 = num2 - num7 / weaponWeight;
float num9 = num4 - num7 * num1 / weaponInertia;
float num10 = 0.5f * weaponWeight * num8 * num8 + 0.5f * weaponInertia * num9 * num9;
double num11 = (double) num10;
double num12 = num6 - num11;
float num13 = num10 * 0.5f;
return 0.067f * (float) (num12 + 0.5);
public static float CalculateStrikeMagnitudeForThrust(
float thrustWeaponSpeed,
float weaponWeight,
float extraLinearSpeed,
bool isThrown)
{
float num = thrustWeaponSpeed + extraLinearSpeed;
if (!isThrown)
weaponWeight += 2.5f;
return 0.125f * (0.5f * weaponWeight * num * num);
}
public static float ComputeRawDamageNew(
DamageTypes damageType,
float magnitude,
float armorEffectiveness,
float absorbedDamageRatio)
{
float num1 = 0.0f;
float factorByDamageType = CombatStatCalculator.GetBluntDamageFactorByDamageType(damageType);
float num2 = magnitude * factorByDamageType;
float num3 = (float) (100.0 / (100.0 + (double) armorEffectiveness));
float num4 = num1 + num2 * num3;
float num5;
switch (damageType)
{
case DamageTypes.Cut:
num5 = Math.Max(0.0f, (float) ((double) magnitude * (double) num3 - (double) armorEffectiveness * 0.5));
break;
case DamageTypes.Pierce:
num5 = Math.Max(0.0f, (float) ((double) magnitude * (double) num3 - (double) armorEffectiveness * 0.330000013113022));
break;
case DamageTypes.Blunt:
label_5:
return num4 * absorbedDamageRatio;
default:
return 0.0f;
}
num4 += num5 * (1f - factorByDamageType);
goto label_5;
}
private static float GetBluntDamageFactorByDamageType(DamageTypes damageType)
{
float num = 0.0f;
switch (damageType)
{
case DamageTypes.Cut:
num = 0.1f;
break;
case DamageTypes.Pierce:
num = 0.25f;
break;
case DamageTypes.Blunt:
num = 1f;
break;
}
return num;
}

Well this looks incredibly bad to me, on top of the fact that it is not easily modifiable. And it is just a small part of the code for damage output calculation in melee. And it is also not balanced, because cutting damage will deal natively less damages than piercing damages because of the wrong formulae they implemented, spears will be overpowered when swung from a horse and so on and so forth.

So they decided to "fix" the problem by implementing a multiplier of damages of every blade of the game that you can build in the forge (you can see that in the xml files). If you know how to code, this is INCREDIBLY bad design. I'm really afraid that most of the code is difficult to read, difficult to modify and not balanced at all.

It is really good to try to simulate the physical properties of the real world, the economy etc etc but please do that when you have some knowledge in that, not just when you like fiddling around with wrong numbers and terrible simulations... And C# doesn't help by being the most difficult language to read for many reasons, with a really convoluted syntax for many things.

This game is not horribly bad, but it looks like they ported the code of warband to a better architecture but they understood that their architecture was actually really bad to make further progress (for example, dialogs with characters are boring and rare, and it is because their system to implement them looks just so wrong...). I must admit that having all the dialogs in one file in warband was much more convenient.
This is decompiled C# code and is not consistent with what the actual code looks like. While the function of the code is the same, the way it is written is not. Also, many things are incredibly easy to add/modify. While there are some things that can definitely be improved, the overall system is nowhere near as bad as you are trying to make it out to be. Please do more research before deciding to go on a rant about the state of things.
 
Back
Top Bottom