-
Notifications
You must be signed in to change notification settings - Fork 0
Development environment for Mantella and Mantella‐Spell
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.
-
Python version
3.11
I am usingv3.11.6
but other subversions ofv3.11
should work as well - Visual Studio Code (VSCode) as a code editor for both Python and Papyrus
- CreationKit (installed via Steam)
- 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 toMantella.esp
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.
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
Using type hints and letting PyLance do type checking for you is a great way to find bugs early.
- Activate the basic Python type checking by opening the settings of VSCode (Either Gear button in lower left corner or
Crtl + ,
). - In the settings search for
python.analysis.typeCheckingMode
- Change the setting from
off
to at leastbasic
- Go to the latest Pyro release and download the
pyro-master-1656807840.zip
. - 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. - Replace the content in the
pyro
folder with the content of thepyro-master-1656807840.zip
- Clone the Mantella Repo via Git or download its source code and unzip its content into a folder.
- In VSCode, go to File -> Open Folder... and in the dialog navigate to the folder you created in 1. Press Select Folder.
- You will be asked if you trust the authors of this project, click yes.
- At this pint it should look similar to this:
- Next we need to install the required python packages. In the top menu click on Terminal -> New Terminal
- The new terminal opens up in the bottom.
- Switch the terminal from PowerShell to Command Prompt
- This is the point where you now enter/copy the installation commands from Mantella's github page into the terminal. The commands are:
-
py -3.11 -m venv MantellaEnv
(confirm with Enter) -> creates a virtual environment (venv) calledMantellaEnv
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. -
.\MantellaEnv\Scripts\Activate
(confirm with Enter) -> Activates the venvMantellaEnv
. -
pip install -r requirements.txt
(confirm with Enter) -> pip will install all required python packages listed in therequirements.txt
. This will take some time. The process is complete once you type into the terminal again.
-
- 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 dedicatedlaunch.json
for themain.py
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.
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 theSource code.zip
. - The rest of Mantella's mod dependencies.
- Additional helpful mods and tools:
- SSEEdit
- A crash logger.
- More Informative Console to better inspect actors in the game
-
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.
-
Install Mantella's mod requirements into this new profile. (Details below)
-
SKSE: Create a new empty mod called
SKSE64
. Open the downloaded zip file of SKSE. It contains a folder calledData
. Copy the contents of theData
folder into the folder of the new mod you just created. The mod folder should now contain a folder calledScripts
that contains the.pex
files and another folder calledSource
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 theScripts
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 theUIExtensions.bsa
. The extractedscripts
folder should be right next to theUIExtensions.bsa
andUIExtensions.esp
in the folder of the mod. - SKSE_HTTP: Install SKSE_HTTP like a normal mod.
-
MantellaLauncher: Download both the
MantellaLaucnher.dll
and theSource code.zip
from the link above. Create a new empty mod called MantellaLauncher. Extract theScripts
folder from theSource code.zip
to the new mod folder. Next to theScripts
folder create a new folder calledSKSE
that contain a folder calledPlugins
and copy theMantellaLauncher.dll
into thisPlugins
folder. - Address library: Install Address library as a normal mod.
-
SKSE: Create a new empty mod called
-
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 theSpriggit_data
folder. Later you will not want to copy the.vscode
folder or theskyrimse.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.
-
Position the
MantellaSpellDev
mod further up in your modlist so that theSKSE_HTTP
andMantellaLauncher
overwrite the contents ofMantellaSpellDev
(See image above). -
Start VSCode and go to File -> Open folder.... Open the mod folder we created in step 3. Trust the authors.
-
Edit the
task.json
in the.vscode
folder. Change thegamePath
parameter to the folder that contains theSkyrimSE.exe
of your development instance. -
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 theSkyrimSE.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 themods
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.
- Change the value of the variable called
-
Save your changes to
task.json
andskyrimse.ppj
. Thats it, you should be all set now. -
Press
Crtl + Shift + B
to compile the.psc
files of MantellaSpell to.pex