Question for Modders and those who read code

Users who are viewing this thread

Rbtparker13

Veteran
How is Bannerlord code so messy? And any idea WHY it is so messy?

I been reading text after text saying that the code is just a jumbled messed. And I want to know why. Please and thank you.

Edit: Examples are nice. I'm bored here!!
 
Last edited:
-Well

if (weaponComponentData.WeaponClass == WeaponClass.ThrowingKnife || weaponComponentData.WeaponClass == WeaponClass.ThrowingKnife || weaponComponentData.WeaponClass == WeaponClass.Javelin)
{
num4 *= 1.2f;
}

or

public bool CanBackStab(Agent agent)
{
return false;
}
 
The evidence (if you can call it that) of "Bannerlord code so messy" is:

1. They decided to spend multiple months "refactoring" instead of adding new stuff, in the middle of an EA where you're theoretically supposed to add new stuff
2. 99.99% of code projects (game or otherwise) this size are messy.

"Bannerlord code so messy" would be nothing special or out of the ordinary and would likely be not in the top 10 reasons why this EA has been such a disaster.
 
if (weaponComponentData.WeaponClass == WeaponClass.ThrowingKnife || weaponComponentData.WeaponClass == WeaponClass.ThrowingKnife || weaponComponentData.WeaponClass == WeaponClass.Javelin)
{
num4 *= 1.2f;
}
I understand some of this but what is "num4 *=1.2f?
@qwerrecd42 I'm asking to give an excuse on EA or even complain about it. I'm just curious on the whys and hows. It entertains me for a hour or two. Especially when I have to figure out what the fudge is being typed.
 
I understand some of this but what is "num4 *=1.2f?
@qwerrecd42 I'm asking to give an excuse on EA or even complain about it. I'm just curious on the whys and hows. It entertains me for a hour or two. Especially when I have to figure out what the fudge is being typed.
the num is not relevant here.. its the if statement which checks 2 times the same WeaponClass. WeaponClass.ThrowingKnife
 
public bool CanBackStab(Agent agent)
{
return false;
}
Ranting about this code piece is pointless. You can use things like that in your codebase which is fine.
You can simply have this
C#:
public class CoolAgent : Agent {
        /* other stuff */
      public new bool CanBackStab(Agent agent){
          if( agent.IsLawyer) return true;
          
          return false;
     }
}
and it makes the CanBackStab more meaningful especially if you have other classes derived from Agent and behave differently based on its type. You can argue that there are better ways to handle this but "omg they created a simple method for this and not even using parameter" is not applicable for this code piece.

People are not referring to simple coding mistakes or double-checks while saying the codebase is a mess. People are referring to structural problems and overall architecture while saying that.


Just curious and bored basically. Plus I find the TALK of code fascinating. Even if I dislike actually using code myself.
No one can tell you why codebase is messy apart from saying a really basic sentence like "Because they didn't follow any known pattern/architecture/Software Development Practices" unless they worked with TW. So don't expect anything from this thread. As a consumer, you shouldn't care what they are doing with the codebase anyway.
 
Ranting about this code piece is pointless. You can use things like that in your codebase which is fine.
You can simply have this
C#:
public class CoolAgent : Agent {
        /* other stuff */
      public new bool CanBackStab(Agent agent){
          if( agent.IsLawyer) return true;
        
          return false;
     }
}
and it makes the CanBackStab more meaningful especially if you have other classes derived from Agent and behave differently based on its type. You can argue that there are better ways to handle this but "omg they created a simple method for this and not even using parameter" is not applicable for this code piece.

People are not referring to simple coding mistakes or double-checks while saying the codebase is a mess. People are referring to structural problems and overall architecture while saying that.



No one can tell you why codebase is messy apart from saying a really basic sentence like "Because they didn't follow any known pattern/architecture/Software Development Practices" unless they worked with TW. So don't expect anything from this thread. As a consumer, you shouldn't care what they are doing with the codebase anyway.
Thing is, I wouldn´t implement any code when I don´t use it (only if i want to use it in near future). I found this method in 1.4.1 and i found nothing in the roadmap where they say: "We will implement a backstab mechanic".

But you are right, no one can tell why the codebase is messy.

Edit: And I found also other classes and Methods which are not used/ even mentioned in dev blogs
 
Thing is, I wouldn´t implement any code when I don´t use it (only if i want to use it in near future). I found this method in 1.4.1 and i found nothing in the roadmap where they say: "We will implement a backstab mechanic".
But you are right, no one can tell why the codebase is messy.
But that's not how software development works in big codebases with weirdly dynamic teams.
It could be that they had a feature relying on this and that's why they implemented it. And if they removed it because of something else and it could be that they forgot to remove this or assumed that they can re-use it for something else. Is it bad? Yes. Terrible practice. But that's how things work in many companies.

Edit: And I found also other classes and Methods which are not used/ even mentioned in dev blogs
And that also makes sense - I also saw a lot of old code and flying methods that are not called by anyone/anything or even things like called oldSomething ( something like oldEvent ) They started to use Something but still kept oldSomething and only changed its name. That's also really bad and makes it harder to read the code. But not a show stopper.

I would love for you to expand on this information if you have the time and willingness to do so :fruity: .
Something like this? :razz:
C#:
game_menu_castle_town_sneak_grappling_hook_on_consequence

 InformationManager.AddQuickInformation(new TextObject("{=!}TODO You have not any grappling hook!",..
 
giphy.gif

So, there's a lost world underneath... ? ?
Edit: I knew I had read it somewhere about the hook, here in Reddit exactly.
 
Last edited:
Back
Top Bottom