Skip to content

Development environment for Mantella and Mantella‐Spell

Leidtier edited this page Feb 16, 2025 · 8 revisions

This guide will teach how to setup an environment to develop for Mantella and Mantella-Spell. There are certainly other ways to do it, other tools or procedures, but this one works quite well for me.

Tools used

Mandatory

Optional

  • Git - while not required to just make it run, it is needed if you want to commit your changes to Mantella
  • Spriggit - A tool that is able to turn a .esp / .esl into text files and back again, allowing it to be handled by a VCS like Git. Required if commiting changes to Mantella.esp

Setup

Python

If Python isn't already installed, download the version for your system from the link above (most likely Windows 64-bit). Run the installer and when it asks if Python should be added to the PATH, do so.

Visual Studio Code

Download from the link above and install. Start and choose your theme. On the toolbar on the left, click on the Extension tab. VSCode can be extended with extensions that are able to provide lots of new functionalities. Required Extensions:

  • Python by Microsoft (This should also install PythonDebugger and Pylance)
  • Papyrus by Joel Day
    • This also requires an update of the included Papyrus script compiler Pyro

grafik

Configuring Python

Using type hints and letting PyLance do type checking for you is a great way to find bugs early.

  1. Activate the basic Python type checking by opening the settings of VSCode (Either Gear button in lower left corner or Crtl + ,).
  2. In the settings search for python.analysis.typeCheckingMode
  3. Change the setting from off to at least basic

Replacing Pyro in the Papyrus Extension

  1. Go to the latest Pyro release and download the pyro-master-1656807840.zip.
  2. On your system, navigate to C:\Users\{your windows username}\.vscode\extensions\joelday.papyrus-lang-vscode-3.2.0\pyro. This is the location of the Papyrus VSCode extension.
  3. Replace the content in the pyro folder with the content of the pyro-master-1656807840.zip

Mantella

Setup for Mantella

  1. Clone the Mantella Repo via Git or download its source code and unzip its content into a folder.
  2. In VSCode, go to File -> Open Folder... and in the dialog navigate to the folder you created in 1. Press Select Folder.
  3. You will be asked if you trust the authors of this project, click yes.
  4. At this pint it should look similar to this: grafik
  5. Next we need to install the required python packages. In the top menu click on Terminal -> New Terminal
  6. The new terminal opens up in the bottom.
  7. Switch the terminal from PowerShell to Command Prompt grafik
  8. This is the point where you now enter/copy the installation commands from Mantella's github page into the terminal. The commands are:
    1. py -3.11 -m venv MantellaEnv (confirm with Enter) -> creates a virtual environment (venv) called MantellaEnv inside the folder. In Python a virtual environment creates a separate working space for your project and packages inside it don't interfere with other projects. Visual studio will most likely ask you in the bottom right corner if you want to use this venv, confirm with yes. This can take a short moment.
    2. .\MantellaEnv\Scripts\Activate (confirm with Enter) -> Activates the venv MantellaEnv.
    3. pip install -r requirements.txt (confirm with Enter) -> pip will install all required python packages listed in the requirements.txt. This will take some time. The process is complete once you type into the terminal again.
  9. Everything is set up now. To run Mantella directly from VSCode, either open the main.py in the top folder and press F5 to run it (select Python/Python debugger in the top command palette when it pops up), or create a dedicated launch.json for the main.py

Mantella-Spell

Setting up the development environment for Mantella-Spell is a little more involved. While not strictly required, I'm using Mod Organizer 2 for managing mods and I recommend it. I use it through the rest of the guide.

Additional Requirements

On top of VSCode and the CreationKit we also need:

  • The source scripts of SKSE. They are contained in the normal download, but a normal user does not extract them.
  • SkyUI AND the SkyUI SDK 5.1
  • UIExtensions AND BAE to unpack its scripts from it.
  • The latest SKSE_HTTP plugin, download it from the Releases section of the GitHub
  • The latest Mantella Launcher plugin. Download it from the Releases section of the GitHub. You need both the MantellaLauncher.dll and the Source code.zip.
  • The rest of Mantella's mod dependencies.
  • Additional helpful mods and tools:

Setup

  1. Start out with creating a new instance in MO2 called Skyrim Mantella Development. I am developing on the latest version of Skyrim but older versions should work as well.

  2. Install Mantella's mod requirements into this new profile. (Details below) grafik

    • SKSE: Create a new empty mod called SKSE64. Open the downloaded zip file of SKSE. It contains a folder called Data. Copy the contents of the Data folder into the folder of the new mod you just created. The mod folder should now contain a folder called Scripts that contains the .pex files and another folder called Source within that contains the corresponding .psc files.
    • SkyUI SDK: just as with SKSE above, create an empty mod and call it SkyUI_5.1_SDK. Open the SkyUI SDK .zip/.7z that you downloaded and copy the Scripts folder into the new mod.
    • SkyUI: Install like a normal mod.
    • UIExtensions: Install mod as usual. Use BAE (link above) to extract the scripts folder from the UIExtensions.bsa. The extracted scripts folder should be right next to the UIExtensions.bsa and UIExtensions.esp in the folder of the mod.
    • SKSE_HTTP: Install SKSE_HTTP like a normal mod.
    • MantellaLauncher: Download both the MantellaLaucnher.dll and the Source code.zip from the link above. Create a new empty mod called MantellaLauncher. Extract the Scripts folder from the Source code.zip to the new mod folder. Next to the Scripts folder create a new folder called SKSE that contain a folder called Plugins and copy the MantellaLauncher.dll into this Plugins folder.
    • Address library: Install Address library as a normal mod.
  3. Clone the Mantella-Spell repository or download it's source code. Create a new empty mod called MantellaSpellDev in MO2. Copy the contents of the downloaded repository into the new mod without the Spriggit_data folder. Later you will not want to copy the .vscode folder or the skyrimse.ppj back and forth but keep them (you will need to edit with paths on your own system. See steps 6 and 7 below.)

    Note: While the new mod folder will be your working directory, I find it easier if this is not the folder managed by Git. Working with multiple branches seems easier if I just copy the content manually back and forth between this working directory and the different branch folders. But maybe you find another approach that is easier for you.

  4. Position the MantellaSpellDev mod further up in your modlist so that the SKSE_HTTP and MantellaLauncher overwrite the contents of MantellaSpellDev (See image above).

  5. Start VSCode and go to File -> Open folder.... Open the mod folder we created in step 3. Trust the authors.
    grafik

  6. Edit the task.json in the .vscode folder. Change the gamePath parameter to the folder that contains the SkyrimSE.exe of your development instance.

  7. Edit the skyrimse.ppj in the main folder.

    • Change the value of the variable called GameFolder from {Put the path to your Skyrim main folder here} to the directory containing the SkyrimSE.exe of your development instance, just like in step 6.
    • Change the value of the variable called ModsFolder from {Put the path to your mods folder in MO2 here} to the mods directory of your MO2 instance. Press the Show open folders menu... button in MO2 (see below) and select Open Mods folder. Copy the address of this folder into the variable. grafik
  8. Save your changes to task.json and skyrimse.ppj. Thats it, you should be all set now.

  9. Press Crtl + Shift + B to compile the .psc files of MantellaSpell to .pex