If you would like to contribute to the development of this mod, feel free to post a pull request! Here I will explain how I have set up my dev environment for working with multiple branches of Bannerlord. If I have accepted your changes I will credit you by your GitHub username in the changelog and you will be named as a contributor here on the GitHub project page.
Note: This guide is intended for Windows because that is the system I use, but if you are a Linux user you probably have the knowledge to adapt it to your system anyway.
- A Steam account that owns Mount & Blade II: Bannerlord
- About 90GB of available disk space for two instances of the game
- Download SteamCMD from here. AFAIK this is an official Valve mirror. Documentation for SteamCDM can be found here.
- Extract the ZIP file to an easily accessible location like
C:\SteamCMD
and remember that location for later. - Run
steamcmd.exe
once and let it download the necessary files. - When it has finished type
quit
to exit SteamCMD.
- Create a new
.bat
file in the SteamCMD folder and name it something likeinstall_stable.bat
. - Open the file with a text editor and enter the following:
steamcmd.exe +login [username] +force_install_dir .\mb2b_stable +app_update "261550 validate" +quit
- Replace
[username]
with the Steam username that owns the game. - Save and close the file, then execute it from a console or from the explorer.
- It will ask for a password. Enter the password of the Steam user and press continue.
- It will then download the game in the latest stable branch into a folder called
mb2b_stable
in the SteamCMD directory. - Whenever the game has an update ready, you can just run the batch file again and it will update just like the Steam client.
- Create a new
.bat
file in the SteamCMD folder and name it something likeinstall_beta.bat
. - Open the file with a text editor and enter the following:
steamcmd.exe +login [username] +force_install_dir .\mb2b_beta +app_update "261550 -beta [version] validate" +quit
- Replace
[username]
with the Steam username that owns the game. - Replace
[version]
with the game version of the latest beta, which at the time of writing this ise1.5.9
. - Save and close the file, then execute it from a console or from the explorer.
- It will ask for a password. Enter the password of the Steam user and press continue.
- It will then download the game in the latest beta branch into a folder called
mb2b_beta
in the SteamCMD directory. - Whenever the game has an update ready, you can just run the batch file again and it will update just like the Steam client.
- Fork the project, clone it and check out the branch
develop
for the stable game orbeta-develop
for the beta branch. - Open the solution in your dev environment of choice. I personally use Jetbrains Rider, but Visual Studio should work just as well.
- Open the file
Directory.Build.props
and check that the parameters fit your installation of the game instances. Most important areGameVersion
andGameFolder
. - Build the project
BannerlordCheats.csproj
. - The build process should automatically have placed the mod files into your game installation's
Modules
folder. If not, then check the fileDirectory.Build.targets
which contains the console commands that copy the files.
- First of all, download the latest version of Mod Configuration Menu and all of its requirements
and install them into the
Modules
folders of bothmb2b_stable
andmb2b_beta
. - Create a launch configuration in your dev environment with the following properties:
- Executable Path:
[Game Folder]/bin/Win64_Shipping_Client/Bannerlord.exe
(Replace game folder with the same path as in theGameFolder
property inDirectory.Build.props
.) - Working Directory:
[Game Folder]/bin/Win64_Shipping_Client
(Replace same as above.) - Launch Arguments:
/singleplayer _MODULES_*Bannerlord.Harmony*Bannerlord.ButterLib*Bannerlord.UIExtenderEx*Bannerlord.MBOptionScreen*Native*SandBoxCore*CustomBattle*SandBox*StoryMode*Cheats*_MODULES_
- Executable Path:
- Run the configuration. As you can see, Bannerlord is launched directly with a set list of Modules, which is the same thing the native launcher would do for you.
- You should be able to debug the running module code. Try by setting a breakpoint for example in
SubModule.cs
Now you can change the code and commit it. When ready just post the pull request, but please keep these things in mind:
- Be sure your pull request is based on either the
develop
orbeta-develop
branch. You can just commit to one (preferablydevelop
) and I will pull the changes to the other after I have merged your changes. They are supposed to stay the same except for compatibility fixes.master
andbeta
are only for releases. - Please match your code formatting to the existing formatting in the mod.
- Please do not commit any changes to
Directory.Build.props
orDirectory.Build.targets
. This includes version increments. I will take care of that.