Modding:Developing a Content Mod

From Vintage Story Wiki
Revision as of 11:52, 21 March 2024 by Nateonus (talk | contribs) (Finished manual setup of content mod.)
Other languages:
  • English

This page was last verified for Vintage Story version 1.19.4.

Page in progress.

Developing a content mod can be simple, but certain files and folders need to be setup correctly. For more information on what can be achieved with a content mod, see Content Mods.

Selecting an IDE

When creating a content mod, you will likely be using a lot of JSON files. Although JSON is a human-readable format, it can still be beneficial to equip yourself with an Integrated Development Environment (IDE). Simply put, for the purpose of modifying JSON files, an IDE works as a fancy text editor that helps with formatting.

It is recommended to select from one of the IDEs below.

Name Free? Works on... Recommended for Code Mods
Visual Studio (Recommended) Yes - Community Edition Windows Yes
Visual Studio Code Yes Windows, macOS, Linux Yes
JetBrains Rider No Windows, macOS, Linux Yes
Notepad++ Yes Windows No

Content Mod Setup

As stated above, content mods require a certain file and folder structure to function.

Template/Example Setup

In progress.

Manual Setup

Mod Workspace

If you wish to setup your project manually, navigate to your Vintage Story install location, and enter the mods folder. Create a new folder with your mod's name - This will be where all mod-related files will be placed. It is recommended to open this folder in your selected IDE.

Note that creating JSON files may require changing file extensions. If you do not know how to do this, follow these instructions.

ModInfo.json

To register our mod, we have to tell Vintage Story that our mod exists and some details about it. To do this, create a new file called 'modinfo.json' inside your mod workspace, either using your IDE or through Windows. Open the file, and paste the following json code:

{
  "type": "content",
  "modid": "examplecontentmod",
  "name": "VS Wiki Example Content Mod",
  "authors": [
    "Nat @ Vintage Story Wiki"
  ],
  "description": "An example showcase of content mod additions.",
  "version": "1.0.0"
}

This file is a very good example of how a json file is formatted, and you will notice that nearly every asset uses this file format. Json files list a set of "key" : "value" entries, allowing you to change those values to fit what is desired. In this case, the following keys represent:

  • "type": "content" - This tells Vintage Story that the mod is a content mod, and should load the provided assets. The options here are "theme", "content", or "code", however for this mod type we will use "content".
  • "modid": "examplecontentmod" - This is your unique mod ID, which can be any combination of lowercase letters and numbers.
  • "name": "..." - This is your mod's name, and displays how it should be displayed within the game. Note that this is just for display and does not affect the assets you create.
  • "authors": [ "..." ] - This is an array of mod authors. Due to this entry using square brackets ([ ]), it tells us that this value can accept multiple values, which are seperated by commas.
  • "description": "..." - This is the mod description, which will be shown on the mod manager screen in game.
  • "version": "1.0.0" - This is your mod's version. It follows the format of "major.minor.patch", called semantic versioning.

Also note that our file starts and ends with curly brackets ({ }). This tells us that this file contains a single object. If a json file starts with square brackets ([ ]), this tells us that we can register multiple objects within that single file.

You can fill in the values above with your own mod info, or keep them the same. Most tutorials on the wiki will use this modinfo file.

This is just a basic modinfo file. For more information, and a more comprehensive list of available properties, visit the Modinfo page.

Modicon.png

If desired, an image file called 'modicon.png' can be placed or created inside your mod workspace. This will automatically be loaded into Vintage Story, and be displayed next to your mod on the mod manager menu.

Assets Folder

To actually create and modify game assets, Vintage Story searches for specific filepaths. Inside your mod workspace, create a folder called 'assets'. This is where we place our different mod domains. More information on domains can be found in the 'Navigating Assets and Domains' section on this page.

Inside the new assets folder, create another new folder with the same name as your mod id. For example, my folder would be called 'examplecontentmod', as this is my mod id. This new folder is where your mod assets will be created! If a tutorial refers to your 'mod assets' folder, it is likely referring to this folder.

When your mod assets folder has been created, you are officially ready to start modding! Check out the 'What's Next' section to link to tutorials, and come back here when you need a reminder of how to organise your content mod.

Navigating Assets and Domains

Publishing a Content Mod

Updating a Content Mod

What's Next?

Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository