Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
m
Update of version and added 'Update' section
m (Testing visual editor with very minor change)
m (Update of version and added 'Update' section)
Line 1: Line 1:
<languages/>
<languages/>
{{GameVersion|1.18.8-rc.1}}
{{GameVersion|1.19.3}}
<translate>
<translate>
__FORCETOC__
__FORCETOC__
Line 49: Line 49:


== Setup the Environment == <!--T:109-->
== Setup the Environment == <!--T:109-->
Our Mod template makes use of the environment variable <code>VINTAGE_STORY</code>. Which we will set up to contain the path of where your game is installed. The use of the environment helps to keep the setup and the template simple so we recommend using it and will cover it in this article.
Our Mod template makes use of the <code>VINTAGE_STORY</code> ''environment variable''. An environment variable is a stored value within your operating system that can be easily accessed from any program. In this case, the <code>VINTAGE_STORY</code> variable allows our mod template to easily find our installation folder. The first step for setting up our environment is to create this environment variable to link to our game installation path.


<!--T:110-->
<!--T:110-->
The <code>VINTAGE_STORY</code> Environment Variable simplifies reusing your Vintage Story game installation path and helps if multiple modders work on the same project to reference the <code>VINTAGE_STORY</code> Environment Variable and have their game installed where ever they want.
The <code>VINTAGE_STORY</code> environment variable simplifies reusing your Vintage Story game installation path and helps if multiple modders work on the same project to reference the <code>VINTAGE_STORY</code> Environment Variable and have their game installed where ever they want. As well as this, it increases the efficiency of updating any existing mods.


=== Windows === <!--T:111-->
=== Windows === <!--T:111-->
Line 58: Line 58:
<!--T:112-->
<!--T:112-->
Here you have two options to set the environment variable:
Here you have two options to set the environment variable:
* Use this short PowerShell script. Open the ''Windows PowerShell'' Application and paste the following into it and hit ''ENTER''
* Use this short PowerShell script. Open the ''Windows PowerShell'' Application, paste the following into it, and hit ''ENTER.''
<syntaxhighlight lang=shell>
<syntaxhighlight lang=shell>
[Environment]::SetEnvironmentVariable("VINTAGE_STORY", "$Env:AppData\Vintagestory", "User")
[Environment]::SetEnvironmentVariable("VINTAGE_STORY", "$Env:AppData\Vintagestory", "User")
Line 96: Line 96:
* If you use another shell see their documentation on how their shell startup file is called
* If you use another shell see their documentation on how their shell startup file is called
Note: If you are using <code>~/.bash_profile</code> or <code>~/.zprofile</code> you will have to Logout and Login again to apply the changes. When using <code>~/.bashrc</code> or <code>~/.zshrc</code> you only need to restart the application that needs to use the environment variable (Visual Studio, Rider, Visual Studio Code, Terminal).
Note: If you are using <code>~/.bash_profile</code> or <code>~/.zprofile</code> you will have to Logout and Login again to apply the changes. When using <code>~/.bashrc</code> or <code>~/.zshrc</code> you only need to restart the application that needs to use the environment variable (Visual Studio, Rider, Visual Studio Code, Terminal).


== Setup a Mod  == <!--T:121-->
== Setup a Mod  == <!--T:121-->
Line 118: Line 117:
<!--T:127-->
<!--T:127-->
Once the template is installed you will see it inside Visual Studio and Rider. From there you can use the templates to create a new Project.
Once the template is installed you will see it inside Visual Studio and Rider. From there you can use the templates to create a new Project.


==== Visual Studio ==== <!--T:128-->
==== Visual Studio ==== <!--T:128-->
Line 130: Line 128:


<!--T:131-->
<!--T:131-->
Open Visual Studio and click on ''Create a new project''. If you installed the ''VintageStory.Mod.Templates'' you can then select '''Vintage Story Mod'''.
Open Visual Studio and click on ''Create a new project''. If you installed the ''VintageStory.Mod.Templates'' you can then select '''Vintage Story Mod'''. Your project name ''must'' be only lowercase letters for your mod to function correctly. It is recommended to enable the various include options in the setup.
<gallery mode="packed-hover" widths="400px" heights="300px">
<gallery mode="packed-hover" widths="400px" heights="300px">
File:Vs-cp-template.png|Visual Studio Mod Template
File:Vs-cp-template.png|Visual Studio Mod Template
Line 205: Line 203:
dotnet new vsmod --AddSolutionFile --IncludeVSSurvivalMod -o mytestmod
dotnet new vsmod --AddSolutionFile --IncludeVSSurvivalMod -o mytestmod
</syntaxhighlight>
</syntaxhighlight>
<!--T:148-->
<br>
----
<br>


<!--T:149-->
<!--T:149-->
Line 386: Line 379:
<!--T:180-->
<!--T:180-->
Note: Make sure you use your own unique <code>modid</code> else you won't be able to upload the mod to the VSModDB.
Note: Make sure you use your own unique <code>modid</code> else you won't be able to upload the mod to the VSModDB.
== Updating the Mod ==
If your mod is setup correctly, updating can be done by updating the <code>VINTAGE_STORY</code> envrionment variable to your new path.
Repeat the steps made in [[Modding:Setting up your Development Environment#Setup the Environment|Setup the Environment]] to edit the environment variable, and rebuild your mod. It is likely that mods will break on certain updates, however fixing them is often quite simplistic, and errors are well documented. To check your update has worked, debug your mod and check the game version on the main menu.


= Moving Forward = <!--T:70-->
= Moving Forward = <!--T:70-->
Confirmedusers
711

edits