Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
m
use Syntax-Template; some minor corrections / clarifications
mNo edit summary
m (use Syntax-Template; some minor corrections / clarifications)
Line 38: Line 38:
== Setup using Mod template ==
== Setup using Mod template ==


To get started download the VSModTemplate solution ([https://github.com/anegostudios/vsmodtemplate/releases/download/1.5.4/VSModTemplate-v1.5.4.zip here]). Now you simply need to extract the zip archive to your desired place:
To get started download the VSModTemplate solution from [https://github.com/anegostudios/vsmodtemplate/releases/latest GitHub] ([https://github.com/anegostudios/vsmodtemplate/releases/download/1.5.5/vsmodtemplate-1.5.5.zip direct link]). Now you simply need to extract the zip archive to your desired destination.


[[File:VSMods9.png]]
[[File:VSMods9.png]]


Navigate to <code>VSMods</code> and double click <code>VSMods.sln</code> (only works if VisualStudio is installed). Alternatively you can also start VisualStudio hit <code>Open Project/ Solution</code>, navigate to the extracted folder and select <code>VSMods.sln</code>.
Navigate to <code>vsmodtemplate-x.y.z</code> and double click <code>VSMods.sln</code> (only works if Visual Studio is installed). Alternatively you can also start Visual Studio hit <code>File -> Open -> Project/Solution...</code>, navigate to the extracted folder and select <code>VSMods.sln</code>.


But before you can start to work, you have to set up the ModTools first.
But before you can start to work, you have to set up the ModTools first.
Line 67: Line 67:
=== Setup ===
=== Setup ===


''Syntax: <code>setup [optional path]</code>''
{{Syntax|setup [optional path]}}


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 Vintage Story 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 clicking <code>Start</code> [[File:VSMods10.png]]. If everything has been set up correctly, Vintage Story should start.


=== Project Setup (ZIP) ===
=== 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 one major disadvantages, which 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 this is a showstopper for you, we advise you to build a compiled mod.
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 one major disadvantage, which is that the inbuilt source code compiler can only compile code up until C# 6.0, so newer language features are not supported. If this is a showstopper for you, we advise you to build a compiled mod.


==== Add Mod ====
==== Add Mod ====


''Syntax: <code>add <modid></code>''
{{Syntax|add <modid>}}


Adds a new mod project to your workspace, also generates an <code>assets</code>, a <code>src</code> folder and a <code>modinfo.json</code> file. The mod will be added to your visual studio solution and will be loaded by VintageStory. Make sure to fill in all additional information in <code>modinfo.json</code>.
Adds a new mod project to your workspace, also generates an <code>assets</code>, a <code>src</code> folder and a <code>modinfo.json</code> file. The mod will be added to your visual studio solution and will be loaded by Vintage Story. Make sure to fill in all additional information in <code>modinfo.json</code>.


==== Delete Mod ====
==== Delete Mod ====


''Syntax: <code>delete <modid></code>''
{{Syntax|delete <modid>}}


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).
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).


==== Pack Mod ====
==== Pack Mod ====
''Syntax: <code>pack <modid></code>''
{{Syntax|pack <modid>}}


Creates a mod zip file and places it in <code>/releases/<modid>/<modid>_v<modversion>.zip</code>. This file is ready for use and can be shared with other people.
Creates a mod zip file and places it in <code>/releases/<modid>/<modid>_v<modversion>.zip</code>. This file is ready for use and can be shared with other people.


''Syntax: <code>pack-all</code>''
{{Syntax|pack-all}}


Packs all mods in your workspace at once.
Packs all mods in your workspace at once.
Line 102: Line 102:
==== Add Mod ====
==== Add Mod ====


''Syntax: <code>add <modid> compiled</code>''
{{Syntax|add <modid> compiled}}


Adds a compiled zip mod template to your workspace. The difference is that it uses a compiled dll instead of the actual source code. All other commands are equal to the zip ones.
Adds a compiled zip mod template to your workspace. The difference is that it uses a compiled dll instead of the actual source code. All other commands are equal to the zip ones.
Line 108: Line 108:
==== Set Mod ====
==== Set Mod ====


''Syntax: <code>set <modid> <source|compiled></code>''
{{Syntax|set <modid> <source|compiled>}}


Sets the given zip mod either to source or compiled. This can be useful if you want to change the type of your mod later on.
Sets the given zip mod either to source or compiled. This can be useful if you want to change the type of your mod later on.
Line 118: Line 118:
==== Add Mod ====
==== Add Mod ====


''Syntax: <code>add-dll <modid></code>''
{{Syntax|add-dll <modid>}}


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.
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.
Line 124: Line 124:
==== Delete Mod ====
==== Delete Mod ====


''Syntax: <code>delete <modid></code>''
{{Syntax|delete <modid>}}


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).
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).
Line 130: Line 130:
==== Release Mod ====
==== 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.
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.
 


== Manual setup ==
== Manual setup ==
205

edits