Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
m (Typos, minor grammar)
(5 intermediate revisions by the same user not shown)
Line 35: Line 35:
Download and install '''VisualStudio for Mac''' [https://www.visualstudio.com/vs/mac/ here]. Unfortunately, nobody in our team has a mac so we don't know for sure if the following tutorials work on mac without any problems.
Download and install '''VisualStudio for Mac''' [https://www.visualstudio.com/vs/mac/ here]. Unfortunately, nobody in our team has a mac so we don't know for sure if the following tutorials work on mac without any problems.


= Project Setup (SRC) =
The source mod system lets you build mods that ship with source code that is compiled during run-time by the modloader engine. This has the great advantage of being open and easy to modify on the run but also comes with 2 major disadvantages. Up until game version 1.6.x you only have a hardcoded list of library references available to you (System.dll, System.Core.dll, System.Drawing.dll, System.Xml.dll, System.Net.Http.dll, VintagestoryAPI.dll, Newtonsoft.Json.dll, protobuf-net.dll, Tavis.JsonPatch.dll, cairo-sharp.dll), any other reference will not get loaded and thus your mod would fail to compile. The second major disadvantage, affecting all game versions, is that the inbuilt source code compiler can only compile code only up until C# 6.0, so newer language features are not supported. If either of these disadvantages are a showstopper to you, we advise you to build a compiled mod.
== Get the Modtemplate ==
== Get the Modtemplate ==


To get started download the VSModTemplate solution ([https://github.com/anegostudios/vsmodtemplate/releases/download/1.3.3/VSModTemplate-v1.3.3.zip here]). Now you simply need to extract the zip archive to your desired place:
To get started download the VSModTemplate solution ([https://github.com/anegostudios/vsmodtemplate/releases/download/1.4.0/VSModTemplate-v1.4.0.zip here]). Now you simply need to extract the zip archive to your desired place:


[[File:VSMods9.png]]
[[File:VSMods9.png]]
Line 72: Line 69:


Before doing anything else you have to setup your workspace. Just type in <code>setup</code> and it will automatically try to locate your VintageStory installation directory. If it cannot find it, you will be asked to type in the full path. Once you have entered your path, it will update your project files so you can start to work with it. Now open the project again and run your first test by hitting <code>start</code> [[File:VSMods10.png]]. If everything has been done correctly VintageStory should start.
Before doing anything else you have to setup your workspace. Just type in <code>setup</code> and it will automatically try to locate your VintageStory installation directory. If it cannot find it, you will be asked to type in the full path. Once you have entered your path, it will update your project files so you can start to work with it. Now open the project again and run your first test by hitting <code>start</code> [[File:VSMods10.png]]. If everything has been done correctly VintageStory should start.
= Project Setup (ZIP) =
The source mod system lets you build zip mods that can ship source code besides their assets. The source code is compiled during run-time by the modloader engine. This has the great advantage of being open and easy to modify on the run but also comes with 2 major disadvantages. Up until game version 1.7.x you only have a hardcoded list of library references available to you (System.dll, System.Core.dll, System.Drawing.dll, System.Xml.dll, System.Net.Http.dll, VintagestoryAPI.dll, VSCreativeMod.dll, VSSurvivalMod.dll, VSEssentials.dll, Newtonsoft.Json.dll, protobuf-net.dll, Tavis.JsonPatch.dll, cairo-sharp.dll), any other reference will not get loaded and thus your mod would fail to compile. The second major disadvantage, affecting all game versions, is that the inbuilt source code compiler can only compile code only up until C# 6.0, so newer language features are not supported. If either of these disadvantages are a showstopper to you, we advise you to build a compiled mod.


== Add Mod ==
== Add Mod ==
Line 96: Line 97:
= Project Setup (DLL) =
= Project Setup (DLL) =


A convenient setup system for dll mods is not finished yet, please refer to the samples mod repository until then: https://github.com/anegostudios/vsmodexamples
Dll mods are way more powerful than source mods, but they have two major downsides. Firstly, they are not able to carry assets which will be loaded by the game, secondly because they are so powerful they can be dangerous. Besides that dll mods can (unlike the others) have cross mod references, provide APIs and use C# 7. We recommend this type of mod for more experienced mod developers.
 
== Add Mod ==
 
''Syntax: <code>add-dll <modid></code>''
 
Adds a new mod project to your workspace. A generated <code>AssemblyInfo.cs</code> file will be in your properties folder, it contains the mod information (name, author, version, description etc.) so make sure to change them before you spread the mod to other people. The mod will be added to your visual studio solution and will be loaded by VintageStory.
 
== Delete Mod ==
 
''Syntax: <code>delete <modid></code>''
 
Before executing, make sure your project is closed, otherwise you might run into some difficulties. Running this command will delete the given mod completely (irreversible).
 
== Release Mod ==
 
Once you launch VintageStory in your workspace, the dll mod will be compiled. You can find it in your <code>mods</code> folder, with the give name: <code><modid>.dll</code>. If you want to upload this mod or share it with your friends this is the file you need to use.
Confirmedusers, editor, Administrators
886

edits