The Ultimate Introduction to Modding | Starting out? Read this!

Users who are viewing this thread

First of all, I decided to do this because of the large amount of new recruits that appeared on the forums recently, some of them who started posting tutorials which contained unclear, misinforming, or even plainly wrong information. Please read on below. I will do my best to thoroughly and understandably explain most of the things that could be on a new user's mind. To my fellow expert modders: If you find something incorrect in this post, just name it. I shall fix it at the moment of noticing.

The Ultimate Introduction to Modding.
Contains Real, Correct, Time- and User-Proven Information.
By modders. For modders.



Why is this the "Real" tutorial?
Because it is written by a person with, at the moment of posting of this tutorial, over seven years of modding various games, most notably Mount&Blade and Warband (six years plus). I have the highest forum rank available (which actually means only that I've hung around here a lot :mrgreen:), and I have published a few OSP code packs, as well as creating a few stand-alone applications, dedicated to modding this game.

But in other tutorials people tell me to do things a bit differently...
They could tell you that the sky is pink with green dots.
This tutorial contains the information that has been passed on to the new modders in numerous posts and (mostly) long-lost forum threads. I'm giving you this information as I know it, and trust me, I've practised it long enough. Plus, if there are any errors in here, I won't try to defend my incorrect statements, but will make the corrections, so everyone can be sure that this here is 100% quality info.

OK, but this begins to look like a wall of text. I'm starting to not like it.
Suit yourself. This will be a wall of text, but I can assure you it won't be in vain. And I promise pictures. :smile:
Anyways, I'd recommend you grab an ice-cold beer/insert favourite beverage here, let some good music play in the background (if that helps your concentration - it surely helps mine!) and keep reading.
If you just want to know how to set your module up, skip the hidden section. It's full of theory.

What actually is "modding"?
As you probably already know, the word "modding" comes from "modifying", and "mod" can mean either "modification" or "module". But what the word means doesn't really matter.
Shortly put, "modding" means modifying something. In this case you're going to modify the game Mount&Blade or one of its derivatives. Modding actually is programming, but on a basic level, so if you have experience in programming, you shouldn't have any problems in understanding how to mod.

And how does modding in M&B work?
To understand this, you need to understand a few basic, easy concepts of programming. (Programming is actually quite easy, by the way... most of it, at least.) So, open up your Mount&Blade\Modules folder. There is the Native mod that ships with the game, and any mods you may have downloaded and played. Note that I say "Mount&Blade", but this can be any of the games you want. We'll presume we're talking about Warband, so your folder will be "Mount&Blade Warband". Or whatever.
Take a peek inside the Native folder. You'll see a bunch of text files and some folders. Open a text file, let's say "presentations.txt", and scroll down a bit... Unintelligible, isn't it? Except for some text here and there, the rest of it is digits. This is what the game reads, and this is how a mod looks like when it's done.
To make a mod, you can directly edit the text files, although this is a boring, tedious, error-prone job. My advice: don't do it. Of course, I also did it when I first started out (not to make a mod, but to give myself some über stats and.. um... yeah). The other way is to use the "Module System", which is a set of script files (with understandable language and much less numbers!) that are compiled using Python, a programming language. It is important for you to know that although the files from the Module System (I call it ModSys for short) have the .py extension (Python file), the ModSys itself is not written in Python, and (for 99.99% of your needs) you needn't know it (yes, you can use it for complicated stuff if you know it. :smile:). The ModSys uses something way easier - just a bunch of "operations" which do the job. And after you mod these .py files, the real pythonic compiler compiles (translates) these files and creates the .txt files you saw earlier, which the game can read.
The M&B "language" does not have a fixed name. I call it Mount and Blade Language - MABL (pronounced "Mable"), but many people everyone else seems to prefer M&B Script. This does not matter at all, though. You can call it "Ni!" and it would still work. (If you have a shrubbery... :lol:)

All right, I got it. What do I need to do to modify my game?
It depends on what you want to do. If you want to tweak stuff, add some new items, or some troops, or change existing stuff, and you want to do this for personal use (mostly), you can edit the text files - either by hand (NOT recommended) or by using any suitable modder-made application from the Unofficial Editing Tools board.
If you have a serious project in mind, you'll need the ModSys. Also, keep in mind that compiling the ModSys overwrites any changes done in the .txt files.
There are, in my humble opinion, three main categories of modding. These are Coding (writing scripts for awesome stuff, creating new game features) - which means working with the ModSys, Modelling (making the visible stuff: items, houses, anything that is a 3D model) - which is mostly not working with the ModSys. However, to add your stuff to the game you'll still need to know how the ModSys works; and Texturing (giving the 3D models an actual look by using drawings) - of course, most modellers are texturers, but you can include any other type of 2D art (and the game uses that too) in this category. ModSys knowledge not required, but recommended.

I'm beginning to think that you're going to talk about this ModSys even more.
You're right. I'm a coder. My 3D modelling skills are... hm, pre-intermediate at best, and my texturing skills are minimal. (I'm sorry, but I can't draw with a mouse. I draw reasonably good on paper, but I suck hard with the mouse.)
And, as a coder, I'm going to focus more on the coding side. Of course, I'll talk only about the basics, which everyone should know.

And what if I don't want to be a coder?
Very good, but you could still learn something that you'll use someday in the future. If you're looking for software, you can use anything that exports as an .obj/.smd for models and anything that can edit .dds files for textures (or use the DDS Converter for that).
Software for 3D modelling includes Wings3D and Blender (freeware), 3DSMax, Maya, ZBrush (paid) and so on and so forth.
Software for texturing includes GIMP, Paint.NET (freeware), Photoshop (paid) and others.
Look around the tutorials in this forum to understand more game-specific stuff about modelling/texturing. This will be a very good place for you to start.

Kudos to you for reading this sentence. Of course, it's presumed you've read through the whole spoiler.
Now grab yourself a beer or something... if you haven't already. :razz:

Are you finished with the theory? I want to start modding now.
Yes, I am. So, now let's start the modding. You want to setup a Module System, don't you? Well then, just go to the thread where we summarise downloads (found in this same board... or if you click here) and get yourself a fresh ModSys for your particular game of choice. (You're looking for the "Download Module System" section, can't miss it!)
Now. In order to be able to compile the files into game-readable text files, full of numbers and numbers and numbers, and to make your awesome mod come true, you need Python (the language). Having a real pet python might help, but don't count on it. Now, don't go rushing into downloading the latest Python. Here's something really important that you should know: The ModSys does NOT work with any Python newer than 2.x*. Fortunately, the same thread you've already got open also features a link to the Python website, so you've been saved a Googling; grab the latest 2.x.x version from there.
Now all you have to do is to install Python. Using Admin rights, please. Oh, it's a good idea to install it in its preferred
Code:
C:\Python27
directory (if you're still using Python 2.7 in your day and age, oh reader from the future!).
Next up. Go to your Environment Variables to see if everything is OK. For those that don't know what Environment Variables are - well, these are OS things, which your Windows uses. You will only have interest in the "PATH" variable. Now open that window and get to business.
Windows XP: My Computer (right-click) -> Properties -> Advanced -> Environment Variables
Windows 7, 8: My Computer (right-click) -> Properties -> Advanced system settings -> Environment Variables
5E15V.png
Scroll that list until you find the "Path", then click it and hit the "Edit" button down there. This Path variable is basically just a string of paths to certain things which are important for your OS. It's different on every computer.
In order for your compiler to work without any hacks or fixes, you must have your Python folder in your Path variable. For an example, if you did install your Python in
Code:
C:\Python27
, then you should add
Code:
;C:\Python27
at the end of the Path. Do NOT alter the Path in any other way! As it contains important system stuff, it's definitely NOT recommended. Just add that
Code:
;C:\Python27
if it's not there. I think it won't be there, since I had to enter it manually. I think.
Anyways, notice the semicolon (;) that is before the C:\Python27. Entries for different applications are separated with semicolons in the Path variable string, so you should add that semicolon so your OS knows what you're talking about. For Windows 10, be sure not to include the semicolon because it will cause an error during the module setup. And that's about it for setting Python up.
And that's about it for setting Python up.

* That's actually a lie. If you're familiar with Python, you're free to re-write the Python "compiler" that the ModSys uses, and thus convert it to Python 3.

And where is the modding?
Modding comes next. Are you OK? Still alive, computer not exploded? Very well, keep reading! You've set your Pythonic compiler up, now it's time to compile the basis for your new mod.
Now, make sure you have permissions to read and write in your ModSys folder and in your Mount&Blade folder (best is if you can freely change the whole folder). Now, open up your Mount&Blade\Modules, copy Native and paste it in the same place. Change the folder name to your new mod's name.
In this picture, you can see my current "Modules" folder. You can also see which games I play. :smile:

ACpBk.png


P.S. The first Mount&Blade folder is the original game, the second one is Warband, and the third, currently opened, is a downgraded 1.143 version.
Now that you have your new mod folder, you have to make your ModSys use it. Open up your ModuleSystem folder, locate
Code:
module_info.py
and open it. Important! Do NOT double-click the file. If you do it, Python will think that you're trying to compile a Python program, and will basically do nothing. In order for you to edit ModSys files, you need to use a text editor. You can use Notepad, although I'd strongly recommend using Notepad++, a very powerful and free text editor, and the very same software I'm using to write this post.
1XiLd.png
Python ships with IDLE, a text editor, but it's old and bad, don't use it. Anyways, open up your module_info with your favourite text editor, and you will see this:
Code:
# Point export_dir to the folder you will be keeping your module
# Make sure you use forward slashes (/) and NOT backward slashes (\)

export_dir = "../WOTS/Modules/Native/"
#export_dir = "C:/Program Files/Mount&Blade/Modules/Native/"
(Now this right here, "WOTS", is a remnant from pre-2005 (or so), when the game was (temporarily) called "Way of the Sword". If you've played the very first versions of M&B, you can see old stuff still hanging around... :razz:)
Right. So, you see what you have to do. Now, let's give you some overhead. The # mark you see right there means that this line is a comment. If you're a programmer, you know what a comment is, if you're not - a comment is something that stands there for the programmer, not for the computer. Comments are used to take notes, make documentation and whatnot. Damned useful, comments are. Everything followed by a comment is invisible to the compiler, so if someone tells you you have to change both lines, tell them to **** off.
Change your export_dir (the non-commented one) so that it points to your new mod folder, and follow the lead for the slashes.
Omd0h.png
As you can see, the second (commented) line is not changed, and it works OK. Now, you've set your mod up. And here comes the first challenge.

Challenge? What challenge?
Don't worry, it's nothing. You have to double-click the
Code:
build_module.bat
file in your ModSys folder - this is the compiler. Now a console window will pop up and you will see some output.
If you've done everything correctly, you'll see a good output and you can be happy.
If you don't see any errors, but get this instead, you have one job well done.
The picture shows a good output, just not yet completed.


XaazO.png
But. If you've failed to do something from the above, you can get errors. The highest chance of an error you'll get is to see
Code:
'python' is not recognized as internal or external command, operable program or batch file.
about twenty times in a row. What this means is that you haven't set up your "Path" variable properly. Feel free to consult the stickied How to fix "Python not recognised..." thread in the forum.
If/When everything works OK, keep reading.

Uh... I'm getting a "can't open file" or something" error! What do I do?
You must be sure to have Read/Write permissions to your ModSys folder, and to your new mod's folder, of course. You can try running the build_module.bat as an admin, it may work - I haven't tried it, I don't know. However, putting the ModSys folder on the Desktop or in My Documents is bound to fix the problem.

I'm getting another error!
Use the forum's Search function (it's in the top-right corner) or ask a question in the Q&A thread. Do not make a new thread specifically for your question.

All right, my mod compiles properly. What now?
Well, my friend, this means you're done. You have the basis for your mod completed, and all that's left is the real modding itself.
One more thing you should know, though. As you probably noticed, there are four types of .py files in the ModSys folder. Read on below to understand their purposes.
What are header_* files?
Header files contain constants for the game. You can change them, but it's generally not recommended or needed.
If you want to define yourself a new constant, you can do it in the appropriate module_* file.
All operations are documented in
Code:
header_operations.py
What are ID_* files?
ID_* files contain the numerical indexes for everything in your mod. In MABL/MBScript/whatever, everything can be looked at as a list of stuff represented by an index, and ID_* files contain these indexes. ID_* files get re-created with every compile you do, but don't change them.
You can use ID_* files to check what indexes your stuff has - if you get game errors that report an index but not a name, for an example.
What are module_* files?
As you already saw, we edited
Code:
module_info.py
. Module_* files contain all the game stuff, and they are the ones that you will edit. They contain nearly everything - troops, items, scene props, scenes...
You are allowed to edit them. Backing up your ModSys folder from time to time is recommended.
What are process_* files?
The process_* files are responsible for compiling your mod into the game's beloved numbers. Modification to these files seldom happens, and before you do anything, you have to be absolutely sure that you know what you're doing - but for a start, just don't touch them.
The process_* files, unlike the other parts of the ModSys, are written in real Python.

But wait, aren't you going to tell me how to mod?!
This is a path that everyone must walk on their own. In other words, no, I'm not going to tell you how to mod. :mrgreen:
I will, however, give you some tips and links that will be useful for you.

Fine. What are they?
Here we go...
- Firstly, grammar and attitude. Remember these two words, for they are very important. Write properly, be polite to others, and your chances of getting help will increase exponentially. Put spaces after punctuation marks, remember that "u" and "y" and other crap are not words but letters, and no "halp plox". Treat others as your equals, in the way that you want to be treated. Members with experience (that even spare time to answer your questions) should be treated with all the respect you (should) treat your mentors with. Don't be afraid to ask your questions and to use the word "please".
- Stickied topics are your friend. Stickied topics are threads on the forum which always stay on the top, and do that because they are important. Reading them is always a good idea.
- Read the forum rules. They aren't a lot, and are put quite shortly and understandably. Also remember to read the box that appears when you make a new topic. Read it at least once, it won't hurt you.
- If you have a small question, do not make a topic about it. Post your question in the stickied Q&A thread instead.
- Use the forum search and/or Google search on the forum to find things you need.
- The best way to learn modding is to try. Start off small, although that may seem boring as an advice. But trust me, I know it from experience. Starting off small is the good way to start; trying to make a gigantic project from the beginning is a very, very bad idea. Trust me.
- You can read what each "operation" (i.e. ModSys function) does in
Code:
header_operations.py

These were the only tips I can think of right now. Now I'll give you some useful links.
- The Official ModSys Documentation. That's very old and outdated, but the ModSys still works on the same principle. Reading some can't hurt you.
- jik's Updated ModSys tutorial - this is a newer (i.e. from 2009... :iamamoron:) and reworked version of the official one. Pretty useful.
- Ruthven's Beginning to mod thread. It's a compilation of links to tutorials, guides and other stuff. Has proven itself useful.
- Pyrate's Modding 101 thread. Contains useful stuff. (Just ignore the old download links!)
- Caba'drin's ModuleSystem Syntax tutorial. Incredibly useful if you're trying to find your way in MABL. Or MBScript. Or however you call it. :smile:
- Various Modders sharing their experiences with early modding

Wait, how can I edit the World map?
Since you asked, here's something important. In modding, the term map refers only to the World Map, the one where you move around towns with your little guy. Multiplayer maps, called like that similarly to other MP games, are called scenes in the modding section. Know that, because it's highly annoying to come across a person who asks how to edit a map, while he's actually referring to a scene.
But let's get back on the question. To edit the World Map, you need a Map Editor application. There are a few in existence, but the most well-known of them all is Thorgrim's MapEditor. It was made for the old M&B, but it can work with Warband, no matter what people may be telling you. If you're going to use it for Warband, take a look at my Warband MapManager. It takes all the dirty work (needed to make the MapEditor work for Warband), and does it for you.
Here's a link to a very good tutorial (I've followed it myself) that will get you started on the actual map editing.
Also, please note that the larger the map, the more cumbersome it is. Maps with loads of vertices (yes, the map is actually a 3D mesh), like more than 80000, will put a lot of pressure onto people's computers and should generally be avoided.

Is that it?
That's about it. Now it's time for you to venture into the big wide world of modding.





Very great thanks to Caba'drin (our most active admin in these parts of the forum at the present time) for deciding to honor this thread with a sticky. Hope it will serve its purpose. :smile:
Thanks to Dawiduh for translating this topic to Romanian: link to the translated version.


Hope you read, liked, and potentially learned something.
Ideas for improvement? Let me know.

Lumos out.
 
Last edited by a moderator:
Thanks, the situation was getting out of hand. I'll make sure to link every recruit I meet to this.
Maybe spoiler the whole "what+why" intro for folks that want to get to Python installation quickly and call the whole post "The Ultimate Modding Intro". :smile:
 
Wowowow... Well written and entertaining. Congrats for the effort. I'm with MadVader on this, intro with capslock.
Also, I see that you keep using Mono Industrial. Dark color schemes are teh win neat. :smile:
 
You might also want to list this tutorial under worldmap editing - http://forums.taleworlds.com/index.php/topic,162501.0.html by Demonwolf. Nice tutorial Lumos.
 
Thanks everyone. I followed your advice, and reworked the first post a bit.
I included the link to the tutorial, Duh, thanks for reminding me about it.

@Swy: Well, I love light-on-dark. Just prefer it over the opposite. And I have the font configured to Courier New, the good ol' monospaced coder's choice font. :smile:
 
I might have missed it, but just in case - you should also mention that some OSs (f.e. Win7) can cause trouble during compile, if the permissions arent given. An easy way to fix that is to move your mod or mb/warband folder to a non restricted zone (like the desktop). Its also possible to change the permission settings (though i never tried) and one could also attempt to compile "as administrator" (though again i didnt try that).
 
great tutorial lumos!  :mrgreen: sure it will help people out!

you can also see this tutorial, it is a good one  :wink:

http://forums.taleworlds.com/index.php/topic,240134.0.html
 
Is there any way I can import items from mods into my native version? I'd love a helm with a crown for my native game, but there are none.
 
Gambino said:
great tutorial lumos!  :mrgreen: sure it will help people out!

you can also see this tutorial, it is a good one  :wink:

http://forums.taleworlds.com/index.php/topic,240134.0.html

Someone please delete this, so as to not confuse people reading this thread for the first time and accidently using any of the methods proposed in Gambinos thread.
 
Cozur said:
Gambino said:
great tutorial lumos!  :mrgreen: sure it will help people out!

you can also see this tutorial, it is a good one  :wink:

http://forums.taleworlds.com/index.php/topic,240134.0.html

Someone please delete this, so as to not confuse people reading this thread for the first time and accidently using any of the methods proposed in Gambinos thread.

my methods are fully functional and approved. i didnt make them .
 
Gambino said:
Cozur said:
Gambino said:
great tutorial lumos!  :mrgreen: sure it will help people out!

you can also see this tutorial, it is a good one  :wink:

http://forums.taleworlds.com/index.php/topic,240134.0.html

Someone please delete this, so as to not confuse people reading this thread for the first time and accidently using any of the methods proposed in Gambinos thread.

my methods are fully functional and approved. i didnt make them .
Threads like yours was one of the main reasons why Lumos had to make a tutorial. Don't advertise worthless threads.
 
Back
Top Bottom