Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
m
no edit summary
(Marked this version for translation)
mNo edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{GameVersion|1.18.8-rc.1}}
{{GameVersion|1.19.3}}
<translate>
<translate>
__FORCETOC__
__FORCETOC__
== New Template ==
If you are using Windows and Visual Studio, it is highly recommended that you instead follow the following tutorials:
# [[Modding:Preparing For Code Mods|Preparing For Code Mods]]
# [[Modding:Creating A Code Mod|Creating A Code Mod]]
There exists a new template that is significantly easier to setup and work with.
== Software == <!--T:2-->
== Software == <!--T:2-->


Line 13: Line 22:


<!--T:4-->
<!--T:4-->
* [https://www.visualstudio.com/en/vs/community/ Visual Studio Community] is a free and very powerful development environment made by Microsoft and has probably the best support for working with C# and dotnet which are also developed by Microsoft. This is also the tool the Vintage Story Team uses to build the game. It also has a [https://www.visualstudio.com/vs/mac/ MacOS Version]. When using it make sure to install the <code>.NET desktop development</code> Workload as well.
* [https://www.visualstudio.com/en/vs/community/ Visual Studio Community] is a free and very powerful development environment made by Microsoft and has probably the best support for working with C# and dotnet which are also developed by Microsoft. This is also the tool the ''Vintage Story'' Team uses to build the game. It also has a [https://www.visualstudio.com/vs/mac/ MacOS Version]. When using it make sure to install the <code>.NET desktop development</code> Workload as well.


<!--T:88-->
<!--T:88-->
Line 49: Line 58:


== 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 67:
<!--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 105:
* 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 126:
<!--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 137:


<!--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
File:Vs-cp-template-setup.png|Visual Studio Mod Template setup
File:Vs-cp-template-setup.png|Visual Studio Mod Template setup
Line 152: Line 159:
<!--T:136-->
<!--T:136-->
Note: Unfortunately as of writing this Rider does not support those template options as Visual Studio in the UI yet but you can check this [https://youtrack.jetbrains.com/issue/RIDER-16759/Support-parameters-in-custom-project-templates issue] for updates.
Note: Unfortunately as of writing this Rider does not support those template options as Visual Studio in the UI yet but you can check this [https://youtrack.jetbrains.com/issue/RIDER-16759/Support-parameters-in-custom-project-templates issue] for updates.
For now you can make use of those options using the CLI see the  [[Visual Studio Code]] section for how to use it.
For now you can make use of those options using the CLI see the  [[#Visual Studio Code|Visual Studio Code]] section for how to use it.


==== Visual Studio Code ==== <!--T:137-->
==== Visual Studio Code ==== <!--T:137-->
Line 205: Line 212:
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 361: Line 363:


==== Rider Launch Mod ==== <!--T:175-->
==== Rider Launch Mod ==== <!--T:175-->
<gallery mode="packed-hover" widths=500px heights=100px>
<gallery mode="packed-hover" widths="500px" heights="100px">
File:Rider-cp-start-new-ui.png|Rider Launch Mod (New UI)
File:Rider-cp-start-new-ui.png|Rider Launch Mod (New UI)
File:Rider-cp-start.png|Rider Launch Mod
File:Rider-cp-start.png|Rider Launch Mod
Line 386: Line 388:
<!--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-->
Line 398: Line 405:
Or head over to the '''[[Modding:Advanced Items | Advanced Items]]''' page to make your first advanced code item.
Or head over to the '''[[Modding:Advanced Items | Advanced Items]]''' page to make your first advanced code item.
</translate>
</translate>
{{Navbox/modding}}
{{Navbox/codemodding}}
Confirmedusers
642

edits