spaar's Mod Loader (1.7.1) [Besiege v0.45a]

Discussion in 'Besiege: Modding' started by spaar, Mar 18, 2015.

  1. spaar

    spaar Member

    spaar's Mod Loader is currently the only Besiege mod loader out there and enables you to use many mods at once.

    Many thanks to everyone who made this possible and contributed.
    Special thanks to got:
    - @VapidLinus for allowing me to use his code after he was unable to continue working on his own mod loader.
    - @TheGuysYouDespise for allowing me to integrate his block loader into the mod loader.

    Important note: The mod loader does not currently work with the Multiverse update!
    (This means all versions since v0.60, anything that has multiplayer support.)

    If you want to build machines using mods, you can still use the older version of Besiege. (It's available using the Steam beta feature.)

    - Loads all mods placed in Besiege_Data/Mods.
    - An in-game console to show output from the game and from mods and to enter commands to interact with mods. (Open with Ctrl+K by default)
    - An in-game GUI for enabling and disabling mods without having to install/uninstall them. (Open with Ctrl+M) by default)
    - An in-game key mapper for all key combinations in the mod loader itself. (Open with Ctrl+J by default)
    - Update checker that will notify you about new updates.
    - A graphical installer for Windows

    - Many APIs to make developing mods much easier and to make mods more compatible to each other.
    - An in-game object explorer with many features such as showing the GameObject hierarchy and changing some values in Components. (Only in the Developer build, Open with Ctrl+O by default)

    How to install
    You can choose between two versions to download: The normal version if you just want to play Besiege with some mods and the developer version if you want to develop mods yourself. The download links are at the end of this post.
    Either way, the installation process is the same for both versions, see below for your respective platform.

    Windows (Installer)
    There is a graphical installer for Windows available. Just download ModLoader Installer.exe, save it anywhere on your computer and run it.
    If the installer doesn't automatically detect it, use the Browse button to select your Besiege installation, select a version and press "Install Mod Loader".
    The installation might take a while, depending on your internet connection. The program might appear to freeze during the installation but it's just working in the background.
    To update the mod loader, you can just run the program again, select the new version and press Install again.

    There is also a video tutorial on how to install the mod loader and mods by @Shade.

    Linux & Windows (Manual Installation)
    Locate your Besiege installation. If you installed Besiege via Steam, this will usually be in C:\Program Files (x86)\Steam\steamapps\common\Besiege.
    I will from now on refer to this directory as simply Besiege in any paths.
    Copy the file Assembly-UnityScript.dll into Besiege/Besiege_Data/Managed.
    When asked, choose to replace the original file. You may also want to make a backup of the original file before doing this.
    Then create the folder Besiege/Besiege_Data/Mods. Copy SpaarModLoader.dll, the Resources folder and the Blocks folder into it. You will also place any mods you install into this folder.

    Mac OS X
    Locate your Besiege installation (
    If you installed it via Steam, right-click Besiege in your Steam Library, click on Properties, go to Local Files and then click on Browse Local Files.
    If you did not install via Steam, find manually.
    Then right-click on and click on Show Package Content. I will from now on refer to this directory as simply Besiege in any paths.
    Copy the file Assembly-UnityScript.dll into Besiege/Contents/Resources/Data/Managed.
    When asked, choose to replace the original file. You may also want to make a backup of the original file before doing this.
    Then create the folder Besiege/Contents/Mods. Copy SpaarModLoader.dll, the Resources folder and the Blocks folder into it. You will also place any mods you install into this folder.

    That's it, the mod loader should now be installed. If you have any problems or questions, just ask on the forum and I will do my best to help.

    Reporting bugs and other assistance
    You can report bugs and ask questions using GitHub Issues. If you don't have a GitHub account and don't want to create one or can't use GitHub for other reasons, posting on this thread is also an option. However GitHub is preferred, so please use that if you can.
    Include your OS, your Besiege version and your mod loader version in a bug report, as well as a list of all mods you have installed. If you aren't using the newest version of both Besiege and the mod loader, please check if the bug still occurs in the newest versions before reporting.

    For Mod developers
    To get started, take a look at the Visual Studio template.
    The mod loader also has an online documentation for its various APIs.
    Lastly, as a mod developer you can PM me your email address and I will add you to the Besiege Modding Slack team,
    where you can ask me and many other modders for assistance.

    License and Source code
    The mod loader is an open-source project licensed under the MIT license.
    Take a look at the GitHub page for details. Contributions in the form of pull-requests or issues are always welcome!

    There are three available downloads:
    - The Windows Installer
    - The Normal Mod Loader
    - The Developer Version

    [​IMG] [​IMG]

    See the file for a list of changes each version.
    Last edited: Mar 19, 2018
    tytyu3, Sanpyr, Paladius and 5 others like this.
  2. spaar

    spaar Member

    Nevermind the part with not working in the Steam version, apparently that uses the same file now. I could have sworn I saw a SteamWorks namespace in there at some point.
  3. Mtschroll

    Mtschroll New Member

    spaar currently the mod loader is not working on the mac version. I'm currently looking into why not, but one of the big things is that on mac the data folder is simply called Data instead of Besiege_Data.
  4. spaar

    spaar Member

    You are right, that'll break the loader, I forgot about that... I'll see what I can do about that in half an hour or so.
  5. Mtschroll

    Mtschroll New Member

    From looking through the code Unity has a function that calls the root data folder "Application.Datapath" or something like that. I got it to correctly load the Modloader however there is an issue in Addpiece.Update still going on.
  6. spaar

    spaar Member

  7. Mtschroll

    Mtschroll New Member

    They are working, however the Mods folder for mac needs to be under the contents folder instead of the data folder. (Same location as the SavedMachines and etc...)
  8. spaar

    spaar Member

    So, it's Besiege.App/Contents/Data/Mods, right ? Or just Besiege.App/Contents/Mods ?
  9. Mtschroll

    Mtschroll New Member

  10. spaar

    spaar Member

    Alright, thanks for your help, I'll update the main post.
  11. Von

    Von Administrator Staff Member

    Nice Work! Added to modlist
  12. Arpeggio1975

    Arpeggio1975 New Member

    Thanks for the mod loader spaar This is incredible :D
  13. FTWunpop

    FTWunpop New Member

    cood you tell me how to add two mods in it or more
    buicase i only can put one buicase they have same names

  14. spaar

    spaar Member

    You are probably trying to add mods that aren't made for this loader. As far as I know, there is currently no published mod that works with this mod loader. I'm in the process of writing a proper tutorial on how to develop mods using it, maybe once that's out, we'll see some mods coming.
    (I'll also add a note about this in the main post, it seems to cause some confusion)
  15. ITR

    ITR l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ Staff Member

    Do you by chance want to publish it on my modding blog? I'm trying to get as many tutorials there as possible :3
  16. spaar

    spaar Member

    I actually just started my own blog. But I'd be happy to cross-post it on yours or something like that, once it's done :)
  17. ITR

    ITR l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ Staff Member

    Sounds nice :3
  18. ITR

    ITR l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ Staff Member

    Seems like it somehow deletes AddPiece.
    I tried both with and without your modloader in the Mods folder, but AddPiece is gone (can be seen from the output log)

    Also, for after you fix this:
    Can you make all variables in AddPiece public?
    Can you have a variable in the modloader (in the Mods folder) that keeps track of the GUI (in case multiple mods need the GUI)
  19. spaar

    spaar Member

    What do you mean, it deletes AddPiece ? The actual class or the instance of it that exists in the game ? Also, I took a clean install, installed the mod loader and everything works just fine. There are no unusual messages in output_log either. Can you provide some more information ?

    Why make everything there public ? Most stuff is already public anyway, is there anything in particular that you think might be useful ?
    In what way should it keep track of the GUI ? Whether it's shown or not ?

    A lot of questions I know ;) Sorry if I just misunderstood you.
  20. ITR

    ITR l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ Staff Member

    Weird, I re-downloaded the files, and this time it worked.
    Couldn't make my mod load properly though. Didn't get any error-messages in the output, care to take a look (check attachment)

    Especially AddPiece.blockName needs to be public, to help with attaching stuff to gameobjects.

    About GUI, if multiple mods want a gui, it might make them paste GUI's over each other. A variable that kept track of where all the existing gui's are would be nice

    Attached Files

Share This Page