Modding:Setting up your Development Environment: Difference between revisions

From Vintage Story Wiki
fixed links and parameters; minor formatting
m (use Syntax-Template; some minor corrections / clarifications)
(fixed links and parameters; minor formatting)
Line 135: Line 135:


* Create a new project
* Create a new project
* Add at least a library reference to the VintageStoryApi.dll (on windows its located in %appdata%/VintageStory)
* Add at least a library reference to the <code>VintageStoryApi.dll</code> (on Windows it's located in the installation directory)
* Open the project properties. Under debug select "Start external program" select the VintageStory.exe. Also adjust the working directory to where the VintageStory.exe is located
* Open the project properties. Under debug select "Start external program" select the <code>VintageStory.exe</code>. Also adjust the working directory to where the executable is located.
* If you compile to a .dll file, set up a ModInfo attribute in your AssemblyInfo.cs ([https://github.com/anegostudios/vsmodexamples/blob/master/Properties/AssemblyInfo.cs example])
* If you compile to a .dll file, set up a ModInfo attribute in your AssemblyInfo.cs ([https://github.com/anegostudios/vsmodtemplate/blob/master/Properties/AssemblyInfo.cs example])
** Add the following command line arguments: <code>-openWorld="modsamplestest" -p3 --addModPath="C:\path\to\your\bin\folder" --addOrigin="C:\path\to\your\assets\folder\if\you\have\any"</code>
** Add the following command line arguments: <code>-openWorld="modsamplestest" -pcreativebuilding --addModPath="C:\path\to\your\bin\folder" --addOrigin="C:\path\to\your\assets\folder\if\you\have\any"</code>
* If want to ship a source mod or mod with assets, set up a modinfo.json ([https://github.com/copygirl/CarryCapacity/blob/master/resources/modinfo.json example]). Make sure your folders are set up in a way that the modPath contains the modinfo.json and a folder named "src" containg your source files. Optionally it can also contain an assets folder for your assets.  
* If want to ship a source mod or mod with assets, set up a <code>modinfo.json</code> ([https://github.com/copygirl/CarryCapacity/blob/master/resources/modinfo.json example]). Make sure your folders are set up in a way that the modPath contains the modinfo.json and a folder named "src" containing your source files. Optionally it can also contain an assets folder for your assets.  
** Add the following command line arguments: <code>-openWorld="modsamplestest" -p3 --addModPath="C:\path\to\your\modPath"</code>
** Add the following command line arguments: <code>-openWorld="modsamplestest" -pcreativebuilding --addModPath="C:\path\to\your\modPath"</code>
* I recommend adding the [https://github.com/anegostudios/vsmodexamples/blob/master/RedirectLogs.cs RedirectLogs.cs] file to your project, so that you can see the log output in your visual studio output window. You should not ship your mod with it though.  
* I recommend adding the [https://github.com/anegostudios/vsmodexamples/blob/master/Mods/RedirectLogs/src/RedirectLogs.cs RedirectLogs.cs] file to your project, so that you can see the log output in your visual studio output window. Be sure not to ship your mod with it though.
* Run the project and hope for the best :D
* Run the project and hope for the best :D
* To ship a mod have a look at [[Mod Packaging]]
* To ship a mod have a look at [[Mod Packaging]]


If you are having troubles the vsmodexamples you might be able to learn from the [https://github.com/anegostudios/vsmodexamples vsmodexamples project]
If you are having troubles, you might be able to learn from the [https://github.com/anegostudios/vsmodexamples vsmodexamples project]


= Moving Forward =
= Moving Forward =
205

edits