Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
m
Updated navbox to new code navbox.
m (Added extra bit of info for arch linux visual studio code, in case they download the wrong file and have unfixable errors.)
m (Updated navbox to new code navbox.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{GameVersion|1.18.8-rc.1}}
{{GameVersion|1.19.3}}
<translate>
<translate>
__FORCETOC__
__FORCETOC__
Line 13: Line 13:


<!--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 28: Line 28:


<!--T:103-->
<!--T:103-->
Note: If you are on Linux and plan to install Visual Studio Code or Rider using '''Flatpak''' or '''snap''' be aware that there might be some issues with using system tools like .NET 7 or the environment variables. So if possible please use a native installation method if possible. (Also, for arch linux users who prefer visual studio code, use the visual studio code bin aur package since code or code-git has issues with .net)
Note: If you are on Linux and plan to install Visual Studio Code or Rider using '''Flatpak''' or '''snap''' be aware that there might be some issues with using system tools like .NET 7 or the environment variables. So if possible please use a native installation method if possible.




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
File:Vs-cp-template-setup.png|Visual Studio Mod Template setup
File:Vs-cp-template-setup.png|Visual Studio Mod Template setup
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 361: Line 354:


==== 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 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-->
Line 398: Line 396:
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
536

edits