Updated version to come in upcoming YouTube series on SKSE development in early 2023
See: https://github.com/mrowrpurr/HelloWorld_CommonLibSSE-NG
Work in progress...
Upcoming features:
- Including SKSE64 in projects (LE, SE, VR, AE)
- vcpkg for everything, no submodules by default
- supported submodules for CommonLibSSE to stay up-to-date with latest RE efforts
- end-to-end tests which run SKSE tests inside the game
- code coverage (for C++ only - potentially separate reports for unit -vs- e2e tests, gotta try merging support)
- end-to-end tests for Papyrus scripts
- will make sure non-SKSE/Skyrim specific things work cross-platform, e.g. if you want to ship a library
- better CLion support for workflow related to options and compiling
- integrated Papyrus Project File for compiling Papyrus scripts as well as bundling the mod for you for distribution
- simple version which is the simplest working plugin (rather than demonstrating tons of features)
If you use this template, please make your SKSE plugin Open Source ✨
<Insert YouTube Tutorial Video Here>
- Dependencies
- Download or Use Project Template
- Setup Plugin Name and Version
- Configure Open Source License
- Setup Project Folder
- Setup Environment Variables
- Building the project (for different versions of Skyrim)
- Upgrading to Newer Versions of CommonLibSSE and CommonLibVR
- Upgrading to Newer vcpkg Packages
- Working with Papyrus scripts
- Writing Unit Tests for C++
- Example Project Features
The easiest way to get started it by using the Use this template
button on this GitHub repository.
That will create a copy of this repository of your own to get started with!
Alternatively, git clone the project:
git clone https://github.com/mrowrpurr/Mrowr-Purr-SKSE-Template.git
If you are new to
git
, I highly recommend using the GitHub Desktop application. It works with GitHub, GitLab, or any hosted or local git.
Once you have the code downloaded, open CMakeLists.txt
and configure your project name and version:
# Set your SKSE plugin name and version.
project(
ExampleProject
VERSION 1.0.0
LANGUAGES CXX
)
Please make your SKSE plugin publicly available on GitHub with one of these recommended Open Source Licenses:
- MIT
- Apache 2.0
- BSD
This project includes an MIT LICENSE
file which you can edit.
I recommend MIT. CommonLibSSE is MIT. Many Skyrim projects use MIT.
Open LICENSE
and simply add your name:
MIT License
Copyright (c) 2022 <Your Name Here>
Permission is hereby granted, free of charge, to any person obtaining a copy ...
You can review the differences of Open Source Licenses if so desired.
Please only use GPL licenses is you fully understand open source licenses and the impact of releasing software under GPL licenses. Otherwise - don't.
This template uses git submodules to pull in recent versions
of CommonLibSSE (separate versions for AE vs SE), CommonLibVR,
and vcpkg (separate versions for each version of Skyrim).
You must run these commands to setup the git submodules:
git submodule init
git submodule update
The easiest way to get started is to set an environment variable which points to your MO2 or Nexus mods folder.
SKYRIM_MODS="C:\Path\To\Mods"
To set this:
- Hit the Start key
- Start typing "Edit the system environment variables" and choose the option
- Click
Environment Variables...
- Choose
New...
under _"User variables for [user]"- Set
Variable name:
toSKYRIM_MODS
- Set
Variable value:
to the path to your mods folder
With this configured, whenever you build your project a directory will be created in your mods folder named [Your Project Name] - [Skyrim Version]
:
- e.g.
MyProject - AE
orCoolProject - VR
.
Different folders are created for different versions of Skyrim.
A more advanced, but simple, option is to configure different paths for mods for different versions of Skyrim.
If you have different mod folder root paths for different versions of Skyrim or would simply like to output the files in a different location, you can set these environment variables:
SKSE_SKYRIM_AE_DEV="C:\My Mods\My AE Development\"
SKSE_SKYRIM_SE_DEV="C:\My Mods\My SE Development\"
SKSE_SKYRIM_VR_DEV="C:\My Mods\My VR Development\"
If you have these set, they will be used instead of the SKYRIM_MODS
environment variable, if set.
If neither SKYRIM_MODS
nor the respective SKSE_SKYRIM_[version]_DEV
variable(s) are set,
then the plugin output will be put into the relative ./output/
folder here in the project.
To build the project for a certain version of Skyrim, you must "prepare" the project for that version.
To do so, run the PREPARE .bat file in the project folder for your version of Skyrim:
./PREPARE_AE.bat
This will run cmake
and generate the contents of the build/
folder, preparing it to compile and output your SKSE plugin.
Then, build the project!
./BUILD.bat
This compiles the project. Any compilation errors should be visible. If there are none, file should be output to your configured output location from the Setup Environment Variables step.
CommonLibSSE and CommonLibVR are included in the project as git submodules.
The submodules are located here:
CommonLib/
AE/ --> https://github.com/powerof3/CommonLibSSE
SE/ --> https://github.com/powerof3/CommonLibSSE
VR/ --> https://github.com/mrowrpurr/CommonLibVR
At the time of writing, the most frequently updated versions of CommonLib are:
powerof3
's CommonLibSSE repository withdev
anddev-ae
branches for SE and AElfrazer
's CommonLibVR repository (which I forked and made a lazy hack to make it compile which I'll cleanup later but it works)
The way that git submodules work is:
- Each submodule is pinned to a certain commit for the repository
So if you want to update to the latest CommonLibSSE, here are the steps that I currently recommend:
# Update AE to the latest dev-ae
cd CommonLib/AE
git checkout dev-ae
git pull origin dev-ae
# Update SE to the latest dev
cd ../SE
git checkout dev
git pull origin dev
At the time of writing, I have AE and SE pinned to specific commits because the latest dev
and dev-ae
didn't compile for me so I went back just a couple of commits.
For CommonLibVR, I will try to keep mrowrpurr/CommonLibVR up-to-date. Otherwise you may want to switch to a different person's CommonLibVR by updating the submodule to point at a different remote repository.
Just like CommonLib
projects, vcpkg
is included in this project as a submodule with separate versions for each version of Skyrim.
Why? Why not just have 1 vcpkg
globally on the system? Or 1 vcpkg
for the repository?
Sometimes CommonLibSSE/CommonLibVR don't work with the latest versions of public packages, so - to ensure this project tempalte always compiles - I have submodules for vcpkg
for each version of Skyrim pinned to a specific version.
This is a temporary solution. I will switch to requiring specific versions of vcpkgs. For my forks, I will switch to providing them via my vcpkg repo.
To update vcpkg
for any version of Skyrim:
# Update AE (or SE or VR)
cd vcpkg/AE
git checkout master
git pull origin master
One of the awesome features of Skyrim Script Extender (SKSE) is that it can extend scripts.
SKSE::GetPapyrusInterface()->Register(PapyrusFunctions);
In addition to being configured as a C++ CMake project, this project folder is also configured as a Papyrus Project.
... TODO DOCUMENTATION
...
... TODO DOCUMENTATION
...
... TODO
...
- script to build all (AE, SE, and VR) and ideally stop on error
- .zip packaging!
- .ini reading
- add a few forms of Form querying/lookup
- add an example or two of Script reflection and function invocation