Difference between revisions of "Getting Started with SKSE Plugin Development"
imported>3Nd R1m m |
imported>3Nd R1m (Corrected my statement about Ryan's Github guide. It's not outdated, it just not providing guidance for the C2039 errors.) |
||
Line 7: | Line 7: | ||
* [http://forums.bethsoft.com/topic/1496168-wipz-skyrim-script-extender-skse/page-4#entry23595441 Zartar's "noob tutorial" on Bethesda's old forum.] The whole discussion may contain other helpful information too. | * [http://forums.bethsoft.com/topic/1496168-wipz-skyrim-script-extender-skse/page-4#entry23595441 Zartar's "noob tutorial" on Bethesda's old forum.] The whole discussion may contain other helpful information too. | ||
* [https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/wiki Ryan-rsm-McKenzie's Tutorial on GitHub]. However, his tutorial doesn't | * [https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/wiki Ryan-rsm-McKenzie's Tutorial on GitHub]. However, his tutorial doesn't include a solution for the C2039 errors when compiling with modern SDK. | ||
* [https://www.reddit.com/r/skyrimmods/comments/bmg1z7/finally_aiming_for_my_first_skse_plugin_been/ This Reddit discussion] | * [https://www.reddit.com/r/skyrimmods/comments/bmg1z7/finally_aiming_for_my_first_skse_plugin_been/ This Reddit discussion] | ||
* [https://github.com/xanderdunn This GitHub page] | * [https://github.com/xanderdunn This GitHub page] | ||
Credit goes to Bethesda, the SKSE Team, Ryan/Fuggyduff and every | Credit goes to Bethesda, the SKSE Team, Ryan/Fuggyduff and every contributors of this page. | ||
== Requirements == | == Requirements == | ||
Line 37: | Line 37: | ||
#: We're gonna tweak some options within the Configuration Properties. | #: We're gonna tweak some options within the Configuration Properties. | ||
#: You can do so by selecting all projects within the solution explorer (Tip: select the first element and then the last one while holding '''SHIFT''' ) and press '''ALT'''+'''ENTER''' to open the Property Pages. | #: You can do so by selecting all projects within the solution explorer (Tip: select the first element and then the last one while holding '''SHIFT''' ) and press '''ALT'''+'''ENTER''' to open the Property Pages. | ||
#: Also make sure that the '''Configuration''' field is set to '''All Configuration''', as we want them to apply for | #: Also make sure that the '''Configuration''' field is set to '''All Configuration''', as we want them to apply for Debbuging as well as releasing. | ||
## Disable post-build events | ## Disable post-build events | ||
##: The project files include post-build events that we don't want (Such as automatically moving files into Skyrim's directory). | ##: The project files include post-build events that we don't want (Such as automatically moving files into Skyrim's directory). | ||
Line 58: | Line 58: | ||
== What next? == | == What next? == | ||
At this point, we should start making | At this point, we should start making the actual plugin. You can follow [https://github.com/Ryan-rsm-McKenzie/CommonLibSSE/wiki Ryan's Tutorial] while this page is being written. |
Revision as of 20:03, 19 May 2019
The Skyrim Script Extender (SKSE) is a tool that expands scriptings capabilities and adds additional functionality to the game, as well as allowing modders to create plugins to further extend Skyrim's scripting capabilities. SKSE plugins take form as DLLs files that implement new functions into Papyrus, Creation Kit's scripting language. As you may guess, making an SKSE plugin is more difficult than a standard mod but the benefits of doing one are far greater. This guide focus on implementing new functions into Papyrus Scripting and debugging them.
This page is actually incompleted as it doesn't actually provide a complete tutorial on how to make an SKSE plugin project. We try to figure out how to do it ourselves before guiding others, with our only sources being closed threads, incomplete guides and tutorials who never saw any updates. With any progression on our side will come further upgrade, until this guide is completed. Until then, be assured that everything that has already been laid out is correct and up-to-date.
Sources
These are related sources that have inspired this guide. Please note that the instructions may differ from one source to another and that some might simply be completely wrong/outdated.
- Zartar's "noob tutorial" on Bethesda's old forum. The whole discussion may contain other helpful information too.
- Ryan-rsm-McKenzie's Tutorial on GitHub. However, his tutorial doesn't include a solution for the C2039 errors when compiling with modern SDK.
- This Reddit discussion
- This GitHub page
Credit goes to Bethesda, the SKSE Team, Ryan/Fuggyduff and every contributors of this page.
Requirements
- Skyrim Special Edition
- SKSE for Skyrim SE (Also referred as SKSE64)
- SKSE64 source code which is included in the SKSE64 distribution
- SKSE64 example plugin which should be included with the source code but actually isn't. A replacement one will be provided as soon as possible.
- Visual Studio 2019, but you can use an earlier version if you wish.
- And most importantly, you need to know C++ programming.
To eliminate any potential trouble, be sure to have the most up-to-date versions of Windows, Skyrim Special Edition and any other toolset specified in this guide. Please keep in mind that this guide does not guarantee Backward/forward compatibility.
Setups
Before making a plugin, you need to set up the environment.
Building SKSE
To make a plugin we'll first need SKSE's source code. However, SKSE was made with an earlier version of Visual Studio and still use outdated toolsets that aren't available within VS2019. Therefore additional setups must be performed.
- Within the SKSE zip files obtained from the official website locate and extract the src/ directory.
- Open the SKSE64 solution src\skse64\skse64.sln with Visual Studio 2019. VS2019 should already be associated with the .sln file type.
- Upon loading, you'll be prompted with the option to "Permanently remove source control association bindings". The SKSE team uses what is called "Source control", which is a way to share, update and checkout codes coming from multiple users. We won't (and can't) use their source control so we can permanently remove any source control association. (image)
- Just after that, a new window will appear and suggest to Retarget the Projects. The default options should be good enough and you can press "Ok". (image)
- Why is that?
- The SKSE project is made with an earlier version of the Visual C++ platform toolset (The 2015 version, there for two major versions behind). It's good development practice to keep your project's component up-to-date and, hopefully, Visual Studio can take care of that itself. However, some more configuration will be needed to successfully build the solution.
- Open the Property Pages for all projects.
- We're gonna tweak some options within the Configuration Properties.
- You can do so by selecting all projects within the solution explorer (Tip: select the first element and then the last one while holding SHIFT ) and press ALT+ENTER to open the Property Pages.
- Also make sure that the Configuration field is set to All Configuration, as we want them to apply for Debbuging as well as releasing.
- Disable post-build events
- The project files include post-build events that we don't want (Such as automatically moving files into Skyrim's directory).
- To disable post-build events, navigate to Build Events => Post-Build Event and change the Use in build field to No.
- Set C++ Language Standard
- Navigate to C/C++ => Language and set C++ Language Standard to ISO C++17 Standard (/std:c++17).
- Force-include <string>
- At this point, any attempt to build the solution will fail and there will be many errors (image), with the most predominant one being
C2039: 'string' is not a member of 'std'
. In other words, many files are using the 'string' class without including the required header to do so. - You can fix this without manually adding #include directives by instead navigating to C/C++ => Advanced and adding "string" (without quotation) in the Force Include File field. This will automatically include the string header whenever it's required.
- At this point, any attempt to build the solution will fail and there will be many errors (image), with the most predominant one being
- Click "Apply" and then "Ok". (Image)
SKSE should be ready to build. To test that, build the solution with the Release configuration. If no error occurs, congratulation! We can move on to the next section.
Testing the build
This section is optional and aims to further validate our home-built SKSE by testing it. Assuming you already have SKSE installed, go ahead and replace the original files from the Skyrim SE directory with the new ones located in src/skse64/x64/Release. The files to replace are skse_(version).dll, skse_loader.exe and skse64_steam_loader.dll. After replacing them, try to run skse_loader.exe. Skyrim should launch without any issues.
Note: Hypothetically, an SKSE built with updated configurations may give better performance than the default one provided by the SKSE team, but the opposite may also be true.
What next?
At this point, we should start making the actual plugin. You can follow Ryan's Tutorial while this page is being written.